In this post, I am going to explain about login with Magic Link in LARAVEL 9. To make password less login with Magic Link, we are going to us https://github.com/grosv/laravel-passwordless-login Package.

Update the app/Http/Controllers/Auth/LoginControlller.php add the login & Login with Magic Link Function. middleware('guest')->except('logout'); } public function username() { return 'username'; } public function login(Request $request) { if($request->input('submit') == 'magic-link'){ $user = $this->loginViaMagicLink($request); if(!$user){ return redirect()->route('login') ->withErrors(['username' => 'User with this username does not exist.']) ->withInput(); } return redirect()->route('login') ->withMessage('Magic Link Sent to the registered email ID.'); } $this->validateLogin($request); // If the class is using the ThrottlesLogins trait, we can automatically throttle // the login attempts for this application.

setRedirectUrl('/home'); $url = $generator->generate(); return (new MailMessage) ->subject('Your Login Magic Link!') ->line('Click this link to log in!') ->action('Login', $url) ->line('Thank you for using our application!'); }
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future. Achieve superior email deliverability with ToastMail! Our AI-driven tool warms up inboxes, monitors reputation, and ensures emails reach their intended destination. Sign up today for a spam-free future.
Community Partners