rmlev/auth0-login-bundle
Laravel bundle that adds Auth0 login to your application, handling the authentication flow, callback routing, and user session setup through simple configuration. Designed for quick integration with minimal boilerplate, it helps wire Auth0 credentials and routes into existing Laravel auth.
Start by confirming this is the right package for your stack. The 1.0.0 release describes a Symfony bundle that wraps the Auth0 PHP SDK — it is not a Laravel package. For a Laravel application you almost always want one of these instead:
auth0/login — Laravel-native guard, login/callback/logout routes, socialite-style flow.auth0/auth0-php — the underlying SDK, for direct Management API access, JWT validation, or M2M tokens.Reach for this Symfony bundle only if you are maintaining a Symfony service alongside your Laravel app and want consistent Auth0 configuration across both.
Where to look first in the repo:
DependencyInjection/ — this is where the SDK is constructed and what parameters map to which SDK option.config/packages/auth0.yaml example — the canonical list of supported options.Minimal configuration (what you'd translate into config/services.php + .env):
AUTH0_DOMAIN=tenant.eu.auth0.com
AUTH0_CLIENT_ID=...
AUTH0_CLIENT_SECRET=...
AUTH0_COOKIE_SECRET=<32+ byte random string>
AUTH0_AUDIENCE=https://api.example.com
First realistic use case: an SPA obtains an access token from Auth0, and your Laravel API validates that JWT on each request, mapping the sub claim to a local user record.
Token validation middleware (the core pattern). Don't let Auth0 own your authorization. Validate the JWT, resolve sub to a local users.auth0_id row, then hand off to Laravel's normal Gate/Policy layer:
$user = User::firstOrCreate(
['auth0_id' => $claims->sub],
['email' => $claims->email, 'name' => $claims->name ?? null]
);
Auth::setUser($user);
Guard/driver pattern. If you're borrowing ideas from the bundle's security integration, implement Illuminate\Contracts\Auth\Guard and register it via Auth::extend(). Keep the Auth0 client behind a container binding so tests can swap in a fake decoder.
Management API for provisioning. Use Auth0\SDK\API\Management from queued jobs or Artisan commands — creating users, assigning roles, sending password-reset tickets. Cache the M2M token (it's valid for 24h by default); don't fetch a new one per call.
M2M / client credentials. For service-to-service calls, validate the JWT and check scope/permissions claims in a dedicated middleware, separate from user authentication.
Cache the JWKS. Bind a cached key set to Laravel's cache (Redis) with a TTL matched to your key rotation policy. This is the single biggest performance lever.
Config mapping. When porting Symfony parameters to Laravel, keep the names identical (domain, client_id, audience, cookie_secret) so anyone moving between the two codebases isn't relearning vocabulary.
publishes(), no facade, no package auto-discovery. Composer will install it happily and nothing will happen. Don't look for config/auth0.php.cookie_secret is stateful. The SDK encrypts its session cookie with it. Rotating it invalidates every active session, and setting it per-deploy (e.g. from a generated value) will produce silent, maddening logout loops. Pin it in your secrets manager.audience vs client_id. The JWT's aud claim must match your API identifier, not the SPA's client ID. Mixing these up is the most common cause of a 401 with a perfectly valid-looking token./.well-known/jwks.json per request adds latency and will get you throttled under load.exp/nbf validation, especially on container platforms with drift.https://{domain}/v2/logout?client_id=...&returnTo=.... Skipping this means users appear "logged out" locally but get silently re-authenticated.auth0/auth0-php you actually pulled in — examples from older blog posts won't compile.iss matches your domain exactly (including trailing slash) → check aud → check exp → then suspect the middleware. Inspect the WWW-Authenticate response header; it usually names the failing condition.How can I help you explore Laravel packages today?