Package Data | |
---|---|
Maintainer Username: | coreymcmahon |
Maintainer Contact: | contact@coreymcmahon.com (Corey Mcmahon) |
Package Create Date: | 2016-06-17 |
Package Last Update: | 2017-11-22 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-04-22 15:05:31 |
Package Statistics | |
---|---|
Total Downloads: | 275 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 4 |
Total Watchers: | 3 |
Total Forks: | 0 |
Total Open Issues: | 0 |
Package for implementing Slack-style "magic auth" links in Laravel
$ composer require montopolis/laravel-magic-auth
In config/app.php inside the providers array...
/*
* Application Service Providers...
*/
App\Providers\AppServiceProvider::class,
App\Providers\AuthServiceProvider::class,
App\Providers\EventServiceProvider::class,
App\Providers\RouteServiceProvider::class,
/*
* Third-party Service Providers...
*/
Montopolis\MagicAuth\Providers\ServiceProvider::class,
$ php artisan vendor:publish
$ vi config/montopolis_magic_auth.php
Use this endpoint to trigger creation of an OTP for the user. The user will be notified via the preselected channel (see montopolis_magic_auth.php
) with either the password, a magic auth link or both (also see config).
POST magic-auth/create
{
"email": "johnny@depp.com",
"_token": "ABCDEFghijklmnOPQRStuvwxyz1234567890"
}
200 OK
{
"message": {
"email": "johnny@depp.com"
}
}
After the OTP has been received and forwarded by the user, you can attempt authentication using this endpoint:
POST magic-auth/verify
{
"email": "johnny@depp.com",
"_token": "ABCDEFghijklmnOPQRStuvwxyz1234567890",
"key": "12345"
}
301 Redirect
Note: After posting to this endpoint, the Laravel session will be authenticated (if successful).
The user can also be redirected as such to automatically sign them in:
GET magic-auth/login?email=johnny@depp.com&_token=ABCDEFghijklmnOPQRStuvwxyz1234567890&key=12345
301 Redirect
Laravel Magic Auth is open-sourced software licensed under the MIT license.