🔑 Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
Laravel Authentication package with built-in two-factor (Authy) and social authentication (Socialite).
Via Composer
$ composer require awes-io/auth
The package will automatically register itself.
You can publish migrations:
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="migrations"
After migrations have been published you can create required db tables by running:
php artisan migrate
Publish views:
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="views"
Publish config file:
php artisan vendor:publish --provider="AwesIO\Auth\AuthServiceProvider" --tag="config"
You can disable additional features by commenting them out:
'enabled' => [
'social',
// 'two_factor',
// 'email_verification',
],
Add new socialite services:
'services' => [
'github' => [
'name' => 'GitHub'
],
...
],
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
...
],
And configure redirect paths:
'redirects' => [
'login' => '/twofactor',
'reset_password' => '/',
...
],
Several .env variables required if additional modules were enabled in config:
# SOCIALITE GITHUB
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
GITHUB_REDIRECT_URL=http://auth.test/login/github/callback
# TWO FACTOR AUTHY
AUTHY_SECRET=
If you enabled social and/or two factor authentication add respective traits to User model class:
use AwesIO\Auth\Models\Traits\HasSocialAuthentication;
use AwesIO\Auth\Models\Traits\HasTwoFactorAuthentication;
class User extends Authenticatable
{
use HasSocialAuthentication, HasTwoFactorAuthentication;
}
To use email verification functionality and to reset passwords, add SendsEmailVerification
and SendsPasswordReset
traits:
use AwesIO\Auth\Models\Traits\SendsPasswordReset;
use AwesIO\Auth\Models\Traits\SendsEmailVerification;
class User extends Authenticatable
{
use SendsEmailVerification, SendsPasswordReset;
}
Add to routes/web.php:
AwesAuth::routes();
You can disable registration:
AwesAuth::routes(['register' => false]);
Package will register several routes.
'login.social'
'login/{service}/callback'
'twofactor.index'
'twofactor.store'
'twofactor.destroy'
'twofactor.verify'
'login.twofactor.index'
'login.twofactor.verify'
'verification.resend'
'verification.code.verify'
'verification.code'
'verification.verify'
You can run the tests with:
composer test
Please see contributing.md for details and a todolist.