Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Auth0 Login Bundle Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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:

  1. The bundle class and DependencyInjection/ — this is where the SDK is constructed and what parameters map to which SDK option.
  2. The security factory — shows how Auth0 is wired into the firewall, which is the piece you'd replicate as a Laravel guard.
  3. Config reference / 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.

Implementation Patterns

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.

Gotchas and Tips

  • Not a Laravel package. No service provider, no publishes(), no facade, no package auto-discovery. Composer will install it happily and nothing will happen. Don't look for config/auth0.php.
  • The 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.
  • Don't verify on every request without caching. Fetching JWKS from /.well-known/jwks.json per request adds latency and will get you throttled under load.
  • Clock skew. Allow a small leeway (30–60s) on exp/nbf validation, especially on container platforms with drift.
  • Logout is two steps. Clearing the Laravel session is not the same as ending the Auth0 SSO session. You need a redirect to https://{domain}/v2/logout?client_id=...&returnTo=.... Skipping this means users appear "logged out" locally but get silently re-authenticated.
  • SDK major versions look very different. The Auth0 PHP SDK v8 rewrote most of the API surface. If the bundle's docs and the installed code disagree, check which major of auth0/auth0-php you actually pulled in — examples from older blog posts won't compile.
  • Debugging order: decode the token at jwt.io → check 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.
  • Extension points worth knowing: custom session/state storage (useful if you want to reuse Laravel's session driver rather than file-based state), and the token cache implementation — both are interfaces you can rebind rather than fork.
  • Version 1.0.0 signals API stability, but with a release note as thin as "Auth0 client integration for Symfony," read the CHANGELOG and diff the security factory before upgrading a production app.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings