gurinder/laravel-auth is a Laravel package for laravel authentication system - including ui.
It currently has 0 GitHub stars and 203 downloads on Packagist (latest version 1.0.4).
Install it with composer require gurinder/laravel-auth.
Discover more Laravel packages by gurinder
or browse all Laravel packages to compare alternatives.
Last updated
It has Google, Facebook, Github and Twitter out of box (login or registering by email and name).
Include via Composer
composer require gurinder/laravel-auth
Publish the views(If required to customize), config(Optional)
// Optional
php artisan vendor:publish --tag="gauth::views"
// Optional
php artisan vendor:publish --tag="gauth::config"
Add following to your User Model Schema
Schema::create('users', function (Blueprint $table) {
...
$table->boolean('email_verified')->default(false);
$table->string('email_verification_token')->nullable();
...
});
Get cliend ids and secret for your applications and put in .env file
FACEBOOK_APP_ID=
FACEBOOK_APP_SECRET=
SOCIALITE_FACEBOOK_CALLBACK="/socialite/facebook/callback"
TWITTER_CLIENT_ID=
TWITTER_CLIENT_SECRET=
TWITTER_ACCESS_TOKEN=
TWITTER_ACCESS_SECRET=
SOCIALITE_TWITTER_CALLBACK="/socialite/twitter/callback"
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_DEVELOPER_KEY=
SOCIALITE_GOOGLE_CALLBACK="${APP_URL}/socialite/google/callback"
GITHUB_CLIENT_ID=
GITHUB_CLIENT_SECRET=
SOCIALITE_GITHUB_CALLBACK="/socialite/github/callback"
Add Social Providers to config/service.php
return [
// ....
'twitter' => [
'client_id' => env('TWITTER_CLIENT_ID'),
'client_secret' => env('TWITTER_CLIENT_SECRET'),
'redirect' => env('SOCIALITE_TWITTER_CALLBACK'),
'access_token' => env('TWITTER_ACCESS_TOKEN'),
'access_secret' => env('TWITTER_ACCESS_SECRET'),
],
'github' => [
'client_id' => env('GITHUB_CLIENT_ID'),
'client_secret' => env('GITHUB_CLIENT_SECRET'),
'redirect' => env('SOCIALITE_GITHUB_CALLBACK'),
],
'facebook' => [
'client_id' => env('FACEBOOK_APP_ID'),
'app_id' => env('FACEBOOK_APP_ID'),
'client_secret' => env('FACEBOOK_APP_SECRET'),
'redirect' => env('SOCIALITE_FACEBOOK_CALLBACK'),
],
'google' => [
'recaptcha_site_key' => env('GOOGLE_RECAPTCHA_SITE_KEY'),
'recaptcha_secret_key' => env('GOOGLE_RECAPTCHA_SECRET_KEY'),
'client_id' => env('GOOGLE_CLIENT_ID'),
'client_secret' => env('GOOGLE_CLIENT_SECRET'),
'developer_key' => env('GOOGLE_DEVELOPER_KEY'),
'redirect' => env('SOCIALITE_GOOGLE_CALLBACK')
]
];
Configure plugin
NOTE: Make sure default role is present in database (If you want you can also use gurinder/laravel-acl)
return [
// Open or Close Registration
'registration_open' => true,
// Name fields to Register, make sure it matches with your user model
'registration_name_fields' => [
// 'name'
'first_name',
'last_name',
],
// validation rules for registeration
// Note: Do not delete data field, its required for registration
'registration_validateion_rules' => [
'first_name' => 'required|string',
'last_name' => 'required|string',
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|max:255|confirmed',
'data' => 'string' // Do not delete this field
],
// Redirect path after user is successfulle logged in
'redirect_path_after_login' => '/login-successful',
// Redirect path after user is successfulle reseted password
'redirect_path_after_password_reset' => '/password-reset-done',
// Redirect path after user registered and email confiremed via mail
'redirect_path_after_email_confirmation' => '/email-is-confirmed',
// User model must have a method $user->assignRole($roles)
// in order to this works
// And it must accept role slug, role id, roles array, role instance
// NOTE -> make sure this role exist in database
'default_roles' => ['subscriber'],
// Email configuration to send welcome and confirmation(email) emails to user
'email_from' => [
'name' => 'Gurinder Laravel Auth',
'email' => '[email protected]'
]
];
redirect_path_after_loginredirect_path_after_loginredirect_path_after_email_confirmationredirect_path_after_loginredirect_path_after_loginThe MIT License (MIT). Please see License File for more information.