- Can I use auth0/jwt-auth-bundle in Laravel? It’s a Symfony package—are there Laravel alternatives?
- No, this bundle is Symfony-specific and won’t work directly in Laravel. For Laravel, use **auth0/auth0-php** or **spatie/laravel-auth0** instead. These packages are designed for Laravel’s ecosystem, including Eloquent user models and Laravel’s security middleware.
- What Laravel versions support Auth0 JWT authentication without Symfony?
- Laravel 9.x+ supports Auth0 via **auth0/auth0-php** (standalone) or **spatie/laravel-auth0** (bundle). Both integrate with Laravel’s Passport or Sanctum for JWT-based APIs. Check compatibility with your Laravel version’s PHP requirements (PHP 8.1+).
- How do I configure Auth0 for Laravel if I’m not using Symfony?
- For Laravel, use **spatie/laravel-auth0** for a pre-built solution with Auth0’s OAuth2/OIDC. Configure your Auth0 app as a **Regular Web Application** (for web) or **Machine-to-Machine** (for APIs), then set callback/logout URLs in Auth0’s dashboard. Laravel’s package handles the rest via `.env` variables.
- Is there a Laravel package that mimics auth0/jwt-auth-bundle’s Symfony features (e.g., Management API, Backchannel Logout)?
- Yes, **spatie/laravel-auth0** includes Management API support and Backchannel Logout (RFC 8414) for Laravel. It also integrates with Laravel’s caching (Redis, APCu) and security middleware. For advanced use cases, **auth0/auth0-php** offers direct SDK access to Auth0’s APIs.
- Will this bundle work with Laravel’s Sanctum or Passport for API authentication?
- No, this Symfony bundle isn’t compatible with Laravel’s Sanctum or Passport. For Laravel APIs, use **auth0/auth0-php** with Passport or **spatie/laravel-auth0** for a unified Auth0 + Sanctum/Passport flow. Both validate JWTs and sync user sessions.
- How do I migrate from Symfony’s auth0/jwt-auth-bundle to Laravel?
- Replace the Symfony bundle with **spatie/laravel-auth0** or **auth0/auth0-php**. Reconfigure Auth0’s app settings (client ID/secret, callback URLs) for Laravel’s routes. Update your security middleware to Laravel’s `auth:api` or Sanctum/Passport guards. Test token validation and session handling.
- Does auth0/jwt-auth-bundle support Laravel’s queue workers for async Auth0 Management API calls?
- No, this bundle is Symfony-only. For Laravel, **auth0/auth0-php** supports async calls via Laravel Queues. Wrap Management API calls (e.g., user provisioning) in a job and dispatch them to a queue worker for background processing.
- Can I use this bundle in a Laravel + Symfony microservice architecture?
- No, this bundle is Symfony-exclusive. For Laravel services, use **auth0/auth0-php** for direct Auth0 API calls or **spatie/laravel-auth0** for web/auth flows. Share Auth0 credentials via a shared config service (e.g., Redis, database) or environment variables.
- How do I handle token caching in Laravel for Auth0 JWTs?
- Use Laravel’s caching drivers (Redis, file, database) with **auth0/auth0-php**. Configure the SDK’s `tokenCache` to store tokens in Laravel’s cache. For example: `$cache = Cache::store('redis'); $auth0->setTokenCache($cache);`. This avoids repeated token requests.
- Are there Laravel packages for Auth0’s Backchannel Logout (RFC 8414) like in Symfony’s bundle?
- Yes, **spatie/laravel-auth0** includes Backchannel Logout support. Configure the `/backchannel` route in Laravel’s `routes/web.php` and ensure it’s publicly accessible. The package handles the Auth0 webhook validation automatically.