Social login for Filament through Laravel Socialite
Add OAuth login through Laravel Socialite to Filament.
Installation
You can install the package via composer:
composer require dutchcodingcompany/filament-socialite
You can publish and run the migrations with:
php artisan vendor:publish --tag="filament-socialite-migrations"
php artisan migrate
You can publish the config file with:
php artisan vendor:publish --tag="filament-socialite-config"
This is the contents of the published config file:
return [
// Allow login, and registration if enabled, for users with an email for one of the following domains.
// All domains allowed by default
'domain_allowlist' => [],
// Allow registration through socials
'registration' => false,
// Specify the providers that should be visible on the login.
// These should match the socialite providers you have setup in your services.php config.
'providers' => [
// 'gitlab' => [
// 'label' => 'GitLab',
// 'icon' => 'fab-gitlab',
// ],
// 'github' => [
// 'label' => 'GitHub',
// 'icon' => 'fab-github',
// ],
],
];
Providers
You should setup the providers with Socialite and/or Socialite Providers and add them to the providers array in the filament-socialite.php
config.
Icons
You can specify a Blade Icon. You can add Font Awesome brand icons made available through Blade Font Awesome by running:
composer require owenvoke/blade-fontawesome
Registration flow
This package supports account creation for users. However, to support this flow it is important that the password
attribute on your User
model is nullable. For example, by adding the following to your users table migration.
$table->string('password')->nullable();
Domain Allowlist
This package supports the option to limit the users that can login with the OAuth login to users of a certain domain. This can be used to setup SSO for internal use.
Customizing view
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-socialite-views"
Usage
Add the buttons component to your login page, just above the closing tag:
You can publish the login page for vanilla Filament by running:
php artisan vendor:publish --tag="filament-views"
Which produces a login page at resources/views/vendor/filament/login.blade.php
.
Filament Fortify
This component can also be added while using the Fortify plugin plugin.
You can publish the login page for Filament Fortify by running:
php artisan vendor:publish --tag="filament-fortify-views"
Which produces a login page at resources/views/vendor/filament-fortify/login.blade.php
.
Filament Breezy
This component can also be added while using the Breezy plugin plugin.
You can publish the login page for Filament Breezy by running:
php artisan vendor:publish --tag="filament-breezy-views"
Which produces a login page at resources/views/vendor/filament-breezy/login.blade.php
.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.