Laravel Socialite

An expressive OAuth 1 & 2 client for Laravel that handles social login boilerplate

Library
Composer
vv5.31.0
5,748 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
81 /100 Excellent
Development Activity 64
Maintenance 72
Community 88
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
81 /100 Excellent
Architecture 84
Code Quality 82
Innovation 70
Learning Curve 86

Laravel Socialite gives a Laravel application a fluent, uniform interface for authenticating users through third-party OAuth providers, shipping first-party drivers for Bitbucket, Facebook, GitHub, GitLab, Google, LinkedIn, Slack, Twitch, and X. Instead of hand-rolling the OAuth redirect/callback dance, token exchange, and user-profile fetch for each provider, an application calls Socialite::driver('github')->redirect() and Socialite::driver('github')->user() and gets back a normalized user object with name, email, avatar, and the provider’s access token.

The package wraps both OAuth 1.0a (via league/oauth1-client, used for X/Twitter) and OAuth 2.0 flows (via Guzzle and firebase/php-jwt for OpenID Connect providers) behind the same Provider interface, and integrates with Laravel’s service container and facades as a first-party Laravel package maintained by the Laravel team. As of the current major version the maintainers are not accepting new first-party drivers; additional providers are covered by the community-maintained Socialite Providers project.

What You Get

  • A Socialite::driver('name')->redirect() / ->user() API that abstracts the OAuth 1/2 authorization-code flow for each supported provider
  • First-party drivers for Bitbucket, Facebook, GitHub, GitLab, Google, LinkedIn (including OpenID Connect), Slack (including OpenID Connect), Twitch, and X
  • A normalized User object exposing id, name, email, nickname, avatar, and the raw provider access token/refresh token
  • Stateless mode for API-driven or mobile OAuth flows that skip Laravel’s session-based CSRF state check
  • A Socialite::fake() testing helper for asserting redirect/callback behavior in feature tests without hitting a real provider

Common Use Cases

  • Adding “Sign in with Google/GitHub/Facebook” buttons to a Laravel application’s login page
  • Building a developer-tools SaaS that authenticates users via their GitHub or GitLab account
  • Linking a user’s Slack or Twitch account to enable OAuth-based API calls on their behalf
  • Supporting stateless OAuth logins in mobile app backends where session-based state isn’t available

Under The Hood

Architecture - SocialiteManager (extending Laravel’s Manager class) resolves the configured driver name to a concrete provider class under src/Two/ (e.g. GithubProvider, GoogleProvider) or src/One/TwitterProvider for OAuth 1.0a; each provider extends Two/AbstractProvider (or One/AbstractProvider), which implements the shared redirect-URL construction, state/PKCE handling, and token exchange against Guzzle, while individual providers only override provider-specific endpoints and user-mapping logic. SocialiteServiceProvider registers the manager and facade into Laravel’s container. Tech Stack - PHP 7.2/8.x targeting Laravel 6 through 13 (illuminate/contracts, illuminate/http, illuminate/support), using GuzzleHTTP for HTTP calls, firebase/php-jwt for verifying OpenID Connect ID tokens, league/oauth1-client for the OAuth 1.0a (X/Twitter) flow, and phpseclib/phpseclib for cryptographic operations required by some providers. Code Quality - 14 test files under tests/ (run via PHPUnit and Orchestra Testbench, a Laravel package-testing harness) cover each provider’s redirect URL construction, token exchange, and user mapping using Mockery-mocked HTTP responses; the project also runs PHPStan for static analysis. Commit and release activity is steady (81 tagged releases, ~5.3 commits/month), reflecting active first-party maintenance despite the driver-freeze policy. API Design - The public API is deliberately small and consistent across all nine providers: Socialite::driver($name)->redirect() and ->user() are the only two calls most integrations need, with stateless(), scopes(), and with() as fluent modifiers, and Socialite::fake() mirrors Laravel’s other facade-testing helpers (Http::fake(), Mail::fake()) for familiarity.

Used by 8 apps in this directory

PHP
73%
MIT

Bagisto

Analytics · Ecommerce

28,186

Open-source Laravel eCommerce platform for building multi-vendor marketplaces, B2B stores, headless commerce, and AI-powered storefronts.

View details
93
Repo Health
75
Technical
67
Dependency
Built with
PHP 73%
Blade 21%
Updated 2 weeks ago
PHP
81%
Apache 2.0

Coolify

Devops · Hosting Control Panel

62,328

Open-source self-hosted PaaS — deploy apps, databases and 280+ services on your own servers with no vendor lock-in

View details
92
Repo Health
86
Technical
70
Dependency
Built with
PHP 81%
Blade 16%
Updated 1 weeks ago
PHP
82%
MIT

Databasement

Databases · Developer Tools · Devops

2,468

Self-hosted database backup manager with a web UI for scheduling, encrypting, and restoring MySQL, PostgreSQL, MongoDB, SQL Server, SQLite, Firebird, and Redis to S3, SFTP, Samba, or local storage.

View details
82
Repo Health
77
Technical
69
Dependency
Built with
PHP 82%
Blade 16%
Updated 1 weeks ago
PHP
85%
Other

Invoice Ninja

Invoicing Finance · Project Management

10,123

Self-hostable invoicing, time-tracking, and multi-gateway payment platform for freelancers and small businesses, with built-in e-invoicing compliance for EU and global standards.

View details
97
Repo Health
83
Technical
62
Dependency
Built with
PHP 85%
Updated 2 weeks ago
PHP
48%
AGPL 3.0

Leantime

Collaboration · Productivity · Project Management

11,672

Project management built for ADHD, autism, and dyslexia — simple as Trello, powerful as Jira

View details
90
Repo Health
68
Technical
65
Dependency
Built with
PHP 48%
CSS 20%
Blade 17%
Updated 2 weeks ago
PHP
65%
AGPL 3.0

LinkStack

Marketing

3,888

Self-hosted, privacy-focused Linktree alternative with themes, analytics, and a drag-and-drop admin panel.

View details
66
Repo Health
56
Technical
68
Dependency
Built with
PHP 65%
Blade 35%
Updated 2 months ago
PHP
63%
Other

OpnForm

Forms Surveys · Marketing

3,752

Build unlimited, embeddable forms with no code — powered by AI, logic rules, and real-time analytics

View details
90
Repo Health
75
Technical
68
Dependency
Built with
PHP 63%
Vue 29%
Updated 2 weeks ago
PHP
63%
AGPL 3.0

Vanguard Backup

Devops

37

Self-hosted backup automation for Ubuntu and Debian servers with S3 storage, SSH-based file and database backup, and multi-channel notifications.

View details
34
Repo Health
80
Technical
69
Dependency
Built with
PHP 63%
Blade 36%
Updated 11 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers