auth0/login
Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.
Maintainers
Requires
- php: ^8.2
- ext-json: *
- auth0/auth0-php: ^8.19
- illuminate/contracts: ^11 || ^12 || ^13
- illuminate/http: ^11 || ^12 || ^13
- illuminate/support: ^11 || ^12 || ^13
- psr-discovery/all: ^1
- psr/cache: ^2 || ^3
Requires (Dev)
- ergebnis/composer-normalize: ^2
- friendsofphp/php-cs-fixer: ^3
- larastan/larastan: ^2
- mockery/mockery: ^1
- orchestra/testbench: ^9
- pestphp/pest: ^2
- pestphp/pest-plugin-laravel: ^2
- phpstan/phpstan: ^1
- phpstan/phpstan-strict-rules: ^1
- psalm/plugin-laravel: ^2.12
- psr-mock/http: ^1
- rector/rector: ^1
- spatie/laravel-ray: ^1.40
- squizlabs/php_codesniffer: ^3
- symfony/cache: ^6 || ^7
- vimeo/psalm: ^5 || ^6 <6.5
- wikimedia/composer-merge-plugin: ^2
Suggests
None
Provides
None
Conflicts
None
Replaces
None
MIT ddfaa0dd16a20db6978ad3b22292bf359366ee68
- Auth0 <support.woop@auth0.com>
authorizationapiOpenIdAuthenticationoauthloginauthlaravelsecureprotectjwtJSON Web TokenJWKauth0json web key
This package is auto-updated.
Last update: 2026-06-08 11:36:33 UTC
README
👁 Build Status
👁 Code Coverage
👁 Total Downloads
👁 License
The Auth0 Laravel SDK is a PHP package that integrates Auth0 into your Laravel application. It includes no-code user authentication, extensive Management API support, permissions-based routing access control, and more.
- Requirements
- Getting Started
- Documentation
- QuickStarts
- Contributing
- Code of Conduct
- Security
- License
Requirements
Your application must use a supported Laravel version, and your host environment must be running a maintained PHP version. Please review our support policy for more information.
You will also need Composer and an Auth0 account.
Supported Laravel Releases
The next major release of Laravel is forecasted for Q1 2025. We anticipate supporting it upon release.
| Laravel | SDK | PHP | Supported Until |
|---|---|---|---|
| 12.x | 7.15+ | 8.4 | Approx. Feb 2027 (EOL for Laravel 12) |
| 8.2 | Approx. Dec 2025 (EOL for PHP 8.3) |
We strive to support all actively maintained Laravel releases, prioritizing support for the latest major version with our SDK. If a new Laravel major introduces breaking changes, we may have to end support for past Laravel versions earlier than planned.
Affected Laravel versions will still receive security fixes until their end-of-life date, as announced in our release notes.
Maintenance Releases
The following releases are no longer being updated with new features by Auth0, but will continue to receive security updates through their end-of-life date.
| Laravel | SDK | PHP | Security Fixes Until |
|---|---|---|---|
| 11.x | 7.13+ | 8.4 | March 2026 (EOL for Laravel 11) |
| 8.3 | March 2026 (EOL for Laravel 11) | ||
| 8.2 | Dec 2026 (EOL for PHP 8.2) |
Unsupported Releases
The following releases are unsupported by Auth0. While they may be suitable for some legacy applications, your mileage may vary. We recommend upgrading to a supported version as soon as possible.
| Laravel | SDK |
|---|---|
| 10.x | 7.5 - 7.12 |
| 9.x | 7.0 - 7.12 |
| 8.x | 7.0 - 7.4 |
| 7.x | 5.4 - 6.5 |
| 6.x | 5.3 - 6.5 |
| 5.x | 2.0 - 6.1 |
| 4.x | 1.x |
Getting Started
The following is our recommended approach to getting started with the SDK. Alternatives are available in our expanded installation guide.
1. Install the SDK
-
For new applications, we offer a quickstart template — a version of the default Laravel 9 starter project pre-configured for use with the Auth0 SDK.
composer create-project auth0-samples/laravel auth0-laravel-app && cd auth0-laravel-app
-
For existing applications, you can install the SDK using Composer.
composer require auth0/login:^7 --update-with-all-dependencies
In this case, you will also need to generate an SDK configuration file for your application.
php artisan vendor:publish --tag auth0
2. Install the CLI
-
Install the Auth0 CLI to manage your account from the command line.
curl -sSfL https://raw.githubusercontent.com/auth0/auth0-cli/main/install.sh | sh -s -- -b .
Move the CLI to a directory in your
PATHto make it available system-wide.sudo mv ./auth0 /usr/local/bin
💡 If you prefer not to move the CLI, simply substitute `auth0` in the CLI steps below with `./auth0`.
-
Authenticate the CLI with your Auth0 account. Choose "as a user" if prompted.
auth0 login
3. Configure the SDK
-
Register a new application with Auth0.
auth0 apps create \ --name "My Laravel Application" \ --type "regular" \ --auth-method "post" \ --callbacks "http://localhost:8000/callback" \ --logout-urls "http://localhost:8000" \ --reveal-secrets \ --no-input \ --json > .auth0.app.json
-
Register a new API with Auth0.
auth0 apis create \ --name "My Laravel Application API" \ --identifier "https://github.com/auth0/laravel-auth0" \ --offline-access \ --no-input \ --json > .auth0.api.json
-
Add the new files to
.gitignore.echo ".auth0.*.json" >> .gitignore
4. Run the Application
Boot the application using PHP's built-in web server.
php artisan serve
Direct your browser to http://localhost:8000 to experiment with the application.
-
Authentication
Users can log in or out of the application by visiting the/loginor/logoutroutes, respectively. -
API Authorization
For simplicity sake, generate a test token using the CLI.auth0 test token \ --audience %IDENTIFIER% \ --scopes "read:messages"
✋ Substitute
%IDENTIFIER%with the identifier of the API you created in step 3 above.Now you can send requests to the
/apiendpoints of the application, including the token as a header.curl --request GET \ --url http://localhost:8000/api/example \ --header 'Accept: application/json' \ --header 'Authorization: Bearer %TOKEN%'
✋ Substitute
%TOKEN%with the test token returned in the previous step.
When you're ready to deploy your application to production, review our deployment guide for best practices and advice on securing Laravel.
Integration Examples
Documentation
- Installation — Installing the SDK and generating configuration files.
- Configuration — Configuring the SDK using JSON files or environment variables.
- Sessions — Guidance on deciding which Laravel Session API driver to use.
- Cookies — Important notes about using Laravel's Cookie session driver, and alternative options.
- Management API — Using the SDK to work with the Auth0 Management API.
- Users — Extending the SDK to support persistent storage and Eloquent models.
- Events — Hooking into SDK events to respond to specific actions.
- Deployment — Deploying your application to production.
You may find the following integration guidance useful:
- Laravel Eloquent — Eloquent ORM is supported.
- Laravel Octane — Octane is not supported at this time.
- Laravel Telescope — Telescope is compatible as of SDK v7.11.0.
You may also find the following resources helpful:
Contributions to improve our documentation are welcomed.
QuickStarts
Community
The Auth0 Community is where you can get support, ask questions, and share your projects.
Contributing
We appreciate feedback and contributions to this library. Before you get started, please review Auth0's General Contribution guidelines.
The Contribution Guide contains information about our development process and expectations, insight into how to propose bug fixes and improvements, and instructions on how to build and test changes to the library.
To provide feedback or report a bug, please raise an issue.
Code of Conduct
Participants are expected to adhere to Auth0's Code of Conduct when interacting with this project.
Security
If you believe you have found a security vulnerability, we encourage you to responsibly disclose this and not open a public issue. We will investigate all reports. The Responsible Disclosure Program details the procedure for disclosing security issues.
License
This library is open-sourced software licensed under the MIT license.
Auth0 is an easy-to-implement, adaptable authentication and authorization platform.
To learn more, check out "Why Auth0?"
