Social Login

Laratic includes built-in support for social authentication, allowing users to sign in using their existing accounts from popular providers. Under the hood, it uses Laravel Socialite to handle the authentication flow.

Supported Providers

The application comes with out-of-the-box support for the following providers:

  • Google - Sign in with Google accounts
  • GitHub - Sign in with GitHub accounts

Available Social Login Buttons

The blocks.auth.social-login component provides pre-built buttons for the following providers. While Google and GitHub are fully configured, the other providers have button components ready but require backend setup:

  • Google - Fully configured and ready to use
  • GitHub - Fully configured and ready to use
  • Facebook - Button component available, requires backend setup
  • Twitter (X) - Button component available, requires backend setup
  • LinkedIn - Button component available, requires backend setup
  • Slack - Button component available, requires backend setup

To use any of these buttons, simply include the component in your authentication views:

<x-blocks.auth.social-login provider="google" />
<x-blocks.auth.social-login provider="github" />
<x-blocks.auth.social-login provider="facebook" />
<x-blocks.auth.social-login provider="twitter" />
<x-blocks.auth.social-login provider="linkedin" />
<x-blocks.auth.social-login provider="slack" />

Adding Additional Providers

While Google and GitHub are configured by default, you can easily add support for any provider supported by Laravel Socialite. The system is designed to be extensible:

  1. Add the provider configuration to config/services.php
  2. Create redirect and callback routes in routes/web.php
  3. Add methods to SocialAuthController following the existing pattern
  4. Add the social login button to your authentication views

All providers follow the same authentication flow, making it straightforward to add new ones.

References

Category Path / Name Description
Controller Auth\SocialAuthController Handles all social authentication logic
Model Models\SocialLogin Stores social provider account information linked to users
Routes GET /auth/google/redirect (auth.google.redirect) Initiates Google authentication
Routes GET /auth/google/callback (auth.google.callback) Handles Google authentication callback
Routes GET /auth/github/redirect (auth.github.redirect) Initiates GitHub authentication
Routes GET /auth/github/callback (auth.github.callback) Handles GitHub authentication callback
Config config/services.php Contains provider credentials and configuration
Component blocks.auth.social-login Reusable social login button component supporting Google, GitHub, Facebook, Twitter, LinkedIn, and Slack
Migration create_social_logins_table Database table for storing social login records