laravel-uis / socialite-ui
A Laravel Socialite UI for the new Laravel Starter Kits
Fund package maintenance!
joelbutcher
paypal.me/joelbutcher
Requires
- php: ^8.2
- illuminate/contracts: ^12.0
- laravel/prompts: ^0.3
- laravel/socialite: ^5.18
Requires (Dev)
- inertiajs/inertia-laravel: ^2.0
- larastan/larastan: ^3.1
- laravel/sanctum: ^4.0
- livewire/livewire: ^3.5.0
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.0
- orchestra/testbench-core: ^10.0
- pestphp/pest: ^3.0
- pestphp/pest-plugin-laravel: ^3.0
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.1
This package is auto-updated.
Last update: 2025-03-14 20:24:28 UTC
README
Laravel Socialite UI is a third-party Laravel package that connects the dots between Laravel Socialite and the new Laravel Starter Kits. It provides a simple way to add social authentication to your Laravel application.
Laravel Socialite UI supports the new React, Vue, Livewire (Volt) and Livewire (class-components) starter kits.
Note
Laravel Socialite UI is a third-party package and is not officially supported by Laravel.
Getting Started
We've worked incredibly hard to make it as easy as possible to add support for Laravel Socialite into your starter kit application.
To start using Laravel Socialite UI, create a new composer project using any of the starter kit templates and compile your frontend assets:
React
laravel new my-app --using=laravel-uis/socialite-ui-react-starter-kit
Vue
laravel new my-app --using=laravel-uis/socialite-ui-vue-starter-kit
Livewire (Volt)
laravel new my-app --using=laravel-uis/socialite-ui-livewire-starter-kit
Livewire (classes)
laravel new my-app --using=laravel-uis/socialite-ui-livewire-starter-kit:dev-components
Screenshots
Features
Laravel Socialite UI comes pre-configured with a bunch of useful features, ready for your next great idea:
1. "Remember Me" functionality
Laravel Socialite UI includes a "Remember Me" feature that allows users to stay logged in, even after they close their browser.
This setting is enabled by default, but can be disabled in the config/socialite-ui.php
configuration file, simply remove this line:
Features::rememberSession(),
2. Global Login
Laravel Socialite UI includes a global login feature that allows users to log into your application from any page.
This setting is enabled by default, but can be disabled by removing the Features::globalLogin()
line from your config file.
3. Generate Missing Emails
Some social providers do not return an email address for the user by default and require additional configuration in order to do so. Laravel Socialite UI includes a feature that generates a unique email address for these users.
This setting can be disabled by removing the Features::generateMissingEmails()
line from your config file.
4. Refresh OAuth Tokens
Laravel Socialite UI includes a feature that automatically refreshes OAuth tokens when they expire when a user
logs into your application. Disable this setting by removing the Features::refreshOAuthTokens()
line from your config file.
5. Create on login
If you have opted out of the Global Login feature of Socialite UI, you can still allow new users to be created from the login screen by uncommenting the Features::createAccountOnFirstLogin(),
line in your config file.
Customization
Laravel Socialite UI is highly customizable and can be tailored to suit your application's needs.
1. User model
By default, Laravel Socialite UI uses the App\Models\User
model for authentication and account creation. However, you may wish to use a different model.
To do so, you may call the SocialiteUI::useUserModel
method from the boot
method of you application's AppServiceProvider
, passing in the fully qualified class name of your desired model.
use SocialiteUI\SocialiteUI; SocialiteUI::useUserModel(Path\To\Your\User::class);
2. Social Account model
Similarly, you may define a different model to be used for storing the details of linked social accounts
by calling the SocialiteUI::useSocialAccountModel
method from the boot
method of you application's AppServiceProvider
.
use SocialiteUI\SocialiteUI; SocialiteUI::useSocialAccountModel(Path\To\Your\SocialAccount::class);
3. Customizing the actions
To keep your codebase clean, Socialite UI uses internal classes to perform specific actions when authenticating a user with a new, or known social account.
However, you are free to override these actions at any point.
Typically, you would call any of these methods within the boot
method of a service provider.
use SocialiteUI\SocialiteUI; // Customize how Socialite UI generates the redirect URL for a provider SocialiteUi::generatesProvidersRedirectsUsing(...); // Customize how Socialite UI resolves users from Socialite SocialiteUi::resolvesSocialiteUsersUsing(...); // Customize how Socialite UI creates users from Socialite SocialiteUi::createUsersFromProviderUsing(...); // Customize how Socialite UI creates social accounts from Socialite SocialiteUi::createSocialAccountsUsing(...); // Customize how Socialite UI updates social accounts from Socialite SocialiteUi::updateSocialAccountsUsing(...); // Customize how Socialite UI handles the `Laravel\Socialite\Two\InvalidStateException` when attempting to resolve a user from Socialite. SocialiteUi::handlesInvalidStateUsing(...); // Override the callback logic used by Socialite UI to authenticate users. SocialiteUi::authenticatesOAuthCallbackUsing(...); // Customize how Socialite UI handles errors when returning from a failed login attempt from a provider. SocialiteUi::handlesOAuthCallbackErrorsUsing(...); // Use a custom prompt your users are shown when they attempt to link a new provider from the "Linked Accounts" screen. SocialiteUi::promptOAuthLinkUsing(...);
Contributing
Thank you for considering contributing to Socialstream! You can read the contribution guide here.
Code of Conduct
In order to ensure that the Laravel development community is welcoming to all, please review and abide by the Code of Conduct.