Seiten · Laravilt
Social Login
OAuth login with Google, GitHub, Facebook, Twitter, LinkedIn, Discord and Jira.
Social login uses Laravel Socialite. You register providers with a SocialProviderBuilder, and a button for each enabled provider appears on the login page.
Enable in the panel
socialLogin() also accepts a plain array of provider names:
Available providers
All providers live in Laravilt\Auth\Drivers\SocialProviders:
| Class | Name |
|---|---|
GoogleProvider | google |
GitHubProvider | github |
FacebookProvider | facebook |
TwitterProvider | twitter |
LinkedInProvider | linkedin |
DiscordProvider | discord |
JiraProvider | jira |
Credentials
Providers read their credentials from config/services.php, as Socialite does:
The callback URL is /{panel}/auth/{provider}/callback, and the redirect route is /{panel}/auth/{provider}/redirect.
If you don't call enabled(), a provider is shown only when both client_id and client_secret are set in config/services.php.
Customizing a provider
The second argument of provider() receives the provider instance:
| Method | Description |
|---|---|
enabled(bool $enabled = true) / disabled() | Force the provider on or off |
label(string $label) | Button label |
icon(string $icon) | Button icon (an SVG path string) |
colorClasses(string $classes) | Tailwind classes for the button |
socialiteDriver(string $driver) | Socialite driver name to use |
redirectUrl(string $url) / callbackUrl(string $url) | Override the URLs |
Passwords for social users
Social sign-ups have no password. By default, requirePasswordForSocialLogin() is on, and those users are sent to a set-password page after logging in. Turn it off with $panel->requirePasswordForSocialLogin(false).
Connected accounts
Add ->connectedAccounts() so users can link or unlink providers from their settings. Linked accounts are stored in social_accounts. See Connected Accounts.
Events
SocialAuthenticationAttempt and SocialAuthenticationSuccessful (includes isNewUser). See Events.