Laravel Passwordless Login


March 5th, 2020


Laravel Passwordless login is a package by Ed Grosvenor that provides a simple, safe, magic login link generator for Laravel apps:

This package provides a temporary signed route that logs in a user. What it does not provide is a way of actually sending the link to the route to the user. This is because I don’t want to make any assumptions about how you communicate with your users.

Here’s a usage example from the project’s readme:

1use App\User;
2use Grosv\LaravelPasswordlessLogin\LoginUrl;
4function sendLoginLink()
6 $user = User::find(1);
8 $generator = new LoginUrl($user);
9 $url = $generator->generate();
11 // OR Use a Facade
12 $url = PasswordlessLogin::forUser($user)->generate();
14 // Send $url in an email or text message to your user
15 return $url;

This package has configuration options that enable you to configure which model is the user model, the login route, and the number of minutes until the link expires. Check out the readme for full configuration options.

You can learn more about this package, get full installation instructions, and view the source code on GitHub at grosv/laravel-passwordless-login.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Laravel News Partners