Auth0
Auth0 OAuth2 provider for Laravel Socialite, enabling drop-in social login through any Auth0 tenant.
Repository Health
Technical Analysis
Auth0 is the official SocialiteProviders package that adds Auth0 as an authentication driver for Laravel Socialite. It extends Socialite’s OAuth2 abstraction with Auth0-specific endpoints for authorization, token exchange, and userinfo, scoped to a tenant’s configurable base URL, so a Laravel app can offer ‘Log in with Auth0’ with the same one-line Socialite::driver() call used for GitHub, Google, or any other provider.
Installation follows the standard SocialiteProviders pattern: require the package via Composer, add the Auth0 environment variables (client ID, secret, redirect URI, and tenant base URL), and register the provider through Laravel’s event listener system. Because it’s built directly on socialiteproviders/manager’s AbstractProvider, it inherits state handling, token exchange, and Guzzle-based HTTP transport, keeping the provider itself to a handful of methods that override the Auth0-specific auth/token/userinfo endpoints and map Auth0’s user payload into a normalized Socialite User object.
What You Get
- Auth0 Socialite driver - registers ‘auth0’ as a Socialite driver via a single event listener, no custom OAuth code required.
- Tenant-aware endpoints - builds authorize, token, and userinfo URLs from a configurable base_url, supporting any Auth0 tenant domain.
- Normalized user mapping - maps Auth0’s sub, nickname, given_name/family_name, and email claims into Socialite’s standard User object.
- Guzzle-based HTTP transport - inherits socialiteproviders/manager’s Guzzle client and OAuth2 state handling instead of reimplementing them.
Common Use Cases
- Add ‘Login with Auth0’ to a Laravel app - drop-in social login using an existing Auth0 tenant for identity.
- Centralize identity for multi-app Laravel systems - route Laravel authentication through an organization’s existing Auth0 tenant alongside other apps.
- Migrate from a custom OAuth2 client to Socialite - replace hand-rolled Auth0 integration code with the standard Socialite driver pattern.
- Support Auth0’s universal login flow - redirect users to Auth0-hosted login pages and receive normalized profile data on callback.
Under The Hood
Architecture The package is a thin adapter: a single Provider class extending SocialiteProviders\Manager\OAuth2\AbstractProvider, plus an Auth0ExtendSocialite listener class that hooks Laravel’s SocialiteWasCalled event to register Provider as the ‘auth0’ driver. Provider overrides only the hook methods AbstractProvider expects — getAuthUrl(), getTokenUrl(), getUserByToken(), and mapUserToObject() — to point at a tenant-specific Auth0 base_url read from config. It has no independent structure of its own; it is entirely dependent on the parent socialiteproviders/manager package for state handling, HTTP transport, and the OAuth2 flow, so a breaking change to AbstractProvider’s hook contract would break this provider immediately.
Tech Stack PHP ^8.0, requiring socialiteproviders/manager ^4.4 as its only runtime dependency. HTTP calls go through GuzzleHttp\RequestOptions via the inherited Guzzle client, and Illuminate\Support\Arr is used for safe array access when mapping Auth0’s response payload. The package uses PSR-4 autoloading under the SocialiteProviders\Auth0 namespace and ships no build tooling — it’s a pure Composer library intended to be installed into a Laravel application.
Code Quality This repository is a read-only subtree split of SocialiteProviders/Providers, so it contains no test files, CI configuration, or linter setup of its own — those live upstream in the monorepo this is split from. The code that is present follows conventional PSR-12 naming and Laravel idioms (typed class constants, protected hook methods), but with only three small files there is limited surface area to assess for broader quality patterns.
API Design The developer-facing API is minimal by design: install via Composer, register one event listener, then call Socialite::driver(‘auth0’) exactly as with any other provider. The only Auth0-specific configuration is a base_url value plus the standard client_id/client_secret/redirect trio, keeping onboarding to a few lines in services.php and .env.