Download the PHP package dennisharrison/laravel-auth0 without Composer
On this page you can find all versions of the php package dennisharrison/laravel-auth0. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download dennisharrison/laravel-auth0
More information about dennisharrison/laravel-auth0
Files in dennisharrison/laravel-auth0
Package laravel-auth0
Short Description Auth0 Laravel SDK. Straight-forward and tested methods for implementing authentication, and accessing Auth0's Management API endpoints.
License MIT
Homepage https://github.com/auth0/laravel-auth0
Informations about the package laravel-auth0
Laravel SDK for Auth0 Authentication and Management APIs.
:books: Feedback
Documentation
- Stateful Applications
- Quickstart — add login, logout and user information to a Laravel application using Auth0.
- Sample Application — a sample Laravel web application integrated with Auth0.
- Stateless Applications
- Quickstart — add access token handling and route authorization to a backend Laravel application using Auth0.
- Sample Application — a sample Laravel backend application integrated with Auth0.
- Examples — code samples for common scenarios.
- Docs site — explore our docs site and learn more about Auth0.
Getting Started
Requirements
- PHP 8.0+
- Laravel 8 / Laravel 9
Illuminate\Session\Middleware\StartSession
enabled inapp/Http/Kernel.php
Please review our support policy to learn when language and framework versions will exit support in the future.
Octane support is experimental and not advisable for use in production at this time.
Installation
Add the dependency to your application with Composer:
Configure Auth0
Create a Regular Web Application in the Auth0 Dashboard. Verify that the "Token Endpoint Authentication Method" is set to POST
.
Next, configure the callback and logout URLs for your application under the "Application URIs" section of the "Settings" page:
- Allowed Callback URLs: The URL of your application where Auth0 will redirect to during authentication, e.g.,
http://localhost:3000/callback
. - Allowed Logout URLs: The URL of your application where Auth0 will redirect to after user logout, e.g.,
http://localhost:3000/login
.
Note the Domain, Client ID, and Client Secret. These values will be used during configuration later.
Publish SDK configuration
Use Laravel's CLI to generate an Auth0 configuration file within your project:
A new file will appear within your project, app/config/auth0.php
. You should avoid making changes to this file directly.
Configure your .env
file
Open the .env
file within your application's directory, and add the following lines appropriate for your application type:
For Stateful Web Applications
Provide a sufficiently long, random string for your `AUTH0_COOKIE_SECRET` using `openssl rand -hex 32`.For Stateless Backend Applications
Setup your Laravel application
Integrating the SDK's Guard requires changes to your config\auth.php
file.
To begin, find the defaults
section. Set the default guard
to auth0
, like this:
Next, find the guards
section, and add auth0
there:
Next, find the providers
section, and add auth0
there as well:
Although it is enabled by default, now is a good time to ensure the StartSession
middleware is enabled in your app/Http/Kernel.php
file:
Add login to stateful web applications
For regular web applications that provide login and logout, we provide prebuilt route controllers to add to your app/routes/web.php
file that will automatically handle your application's authentication flow with Auth0 for you:
Protect routes with middleware
This SDK includes middleware to simplify either authenticating (regular web applications) or authorizing (backend api applications) your Laravel routes, depending on your application type.
Stateful Web Applications
These are for traditional applications that handle logging in and out. The `auth0.authenticate` middleware will check for an available user session and redirect any requests without one to the login route: The `auth0.authenticate.optional` middleware will check for an available user session, but won't reject or redirect requests without one, allowing you to treat such requests as "guest" requests: > Note that the `example.user.template` and `example.guest.templates` views are just examples and are not part of the SDK; replace these as appropriate for your application.Stateless Backend Applications
These are applications that accept an a Access Token through the 'Authorization' header of a request. The `auth0.authorize` middleware will resolve a Access Token and reject any request with an invalid token. The `auth0.authorize` middleware also allows you to optionally filter requests for access tokens based on scopes: The `auth0.authorize.optional` middleware will resolve an available Access Token, but won't block requests without one. This is useful when you want to treat tokenless requests as "guests":Support Policy
Our support windows are determined by the Laravel release support and PHP release support schedules, and support ends when either the Laravel framework or PHP runtime outlined below stop receiving security fixes, whichever may come first.
SDK Version | Laravel Version | PHP Version | Support Ends |
---|---|---|---|
7 | 9 | 8.1 | Feb 2024 |
8.0 | Nov 2023 | ||
8 | 8.1 | Jan 2023 | |
8.0 | Jan 2023 | ||
6 | 8 | 8.1 | Jan 2023 |
8.0 | Jan 2023 |
Deprecations of EOL'd language or framework versions are not considered a breaking change, as Composer handles these scenarios elegantly. Legacy applications will stop receiving updates from us, but will continue to function on those unsupported SDK versions. Please ensure your PHP environment and Laravel framework dependencies always remain up to date.
Octane Support
Octane compatibility is currently considered experimental and unsupported.
Although we are working toward ensuring the SDK is fully compatible with this feature, we do not recommend using this with our SDK in production until we have full confidence and announced support. Due to the aggressive changes Octane makes to Laravel's core behavior, there is opportunity for problems we haven't fully identified or resolved yet.
Feedback and bug fix contributions are greatly appreciated as we work toward full. Octane support.
Feedback
Contributing
We appreciate feedback and contribution to this repo! Before you get started, please see the following:
Raise an issue
To provide feedback or report a bug, please raise an issue on our issue tracker.
Vulnerability Reporting
Please do not report security vulnerabilities on the public Github issue tracker. The Responsible Disclosure Program details the procedure for disclosing security issues.
Auth0 is an easy to implement, adaptable authentication and authorization platform. To learn more checkout Why Auth0?
This project is licensed under the MIT license. See the LICENSE file for more info.
All versions of laravel-auth0 with dependencies
ext-json Version *
ext-mbstring Version *
auth0/auth0-php Version ^8.3.4
illuminate/contracts Version ^8.0 || ^9.0 || ^10.0
illuminate/http Version ^8.0 || ^9.0 || ^10.0
illuminate/support Version ^8.0 || ^9.0 || ^10.0
psr/cache Version ^3.0