auth0/auth0-php
The official Auth0 PHP SDK for Authentication and Management APIs. Build PHP 8.2+ apps with PSR-18/17/7 HTTP support and tailored Laravel, Symfony, and WordPress SDKs. Includes quickstarts for session-based web apps and token-protected backend APIs.
Pros:
Cons:
auth facade or laravel/sanctum. This has not changed.getCredentials()) can conflict with stateless API routes or headless SPAs. Middleware design must be deliberate.Auth0 class integrates into Laravel’s middleware pipeline (e.g. an Auth0Middleware validating sessions/tokens before route access):
public function handle(Request $request, Closure $next) {
$auth0 = app(Auth0::class);
if (!$auth0->getCredentials()) {
return redirect()->to($auth0->login());
}
return $next($request);
}
Auth0 client as a singleton in a service provider so configuration is resolved once and injected consistently:
$this->app->singleton(Auth0::class, fn ($app) => new Auth0(new SdkConfiguration(
domain: config('auth0.domain'),
clientId: config('auth0.client_id'),
clientSecret: config('auth0.client_secret'),
cookieSecret: config('auth0.cookie_secret')
)));
@auth0
<p>Welcome, {{ $auth0->getCredentials()->user->name }}</p>
@endauth0
Authenticate middleware (getCredentialsFromToken(...)).renew(). Previously, a renew flow could accept a token without full verification. For any Laravel app relying on renew() for silent re-authentication — the common case for session-refresh middleware — this is a material security correction, not a cosmetic patch. Upgrade is strongly recommended on security grounds alone.CookieStore decryption and clears undecryptable cookies. This converts a class of malformed-cookie conditions from hard failures into graceful recovery — i.e. fewer 500s and no user stuck in an error loop after a cookie is corrupted or a cookieSecret is rotated.cookieSecret still invalidates sessions. Treat the secret as a managed credential with a documented rotation runbook, and expect (and now tolerate) forced re-authentication.^9.5 and review each 9.x changelog rather than floating.encrypt()/environment management, never log tokens, and validate all Auth0 redirects.cache()->remember() and batch bulk provisioning.CookieStore is even in the request path.renew() is the only refresh path, and that ID tokens are never trusted from outside the SDK? This release makes the answer auditable — do the audit.cookieSecret stored, who can rotate it, and what is the expected user impact of rotation now that undecryptable cookies are cleared automatically?^9.5 and review changelogs, given that removals are landing in minor releases?auth facade with Auth0 for centralized identity; bind the SDK in a service provider; enforce via middleware on protected route groups.users table via the Management API, pairing with Sanctum’s HasApiTokens if both identity systems coexist during transition.auth, Sanctum, Passport), all Management API call sites, and any use of removed experiment status endpoints.renew() ID token validation and CookieStore fixes — treat this as a security/availability patch, not a feature upgrade. Regression-test login, renew, and logout./admin) using the generic SDK; validate session and token paths.POST.POST token endpoint auth..env, cookieSecret generated via openssl rand -hex 32, stored in the team’s secret manager with a documented rotation procedure.^9.5 rather than floating.renew() ID token validation fix removes a class of issue that would otherwise surface as a security finding. Document it in the change record so it is creditable in audits.cookieSecret rotation (expect forced re-auth), and document that experiment status endpoints are gone so future debugging doesn’t chase missing methods.cache()->remember() for user/client lookups and batch any bulk provisioning.cookieSecret or clientSecret invalidates sessions/tokens. Schedule rotations outside peak windows; the SDK now recovers gracefully from stale cookies rather than erroring, but users will still be logged out.How can I help you explore Laravel packages today?