{"id":29573155,"url":"https://github.com/auth0-samples/laravel","last_synced_at":"2025-10-16T01:47:47.367Z","repository":{"id":37821390,"uuid":"59329093","full_name":"auth0-samples/laravel","owner":"auth0-samples","description":"Laravel 9 application demonstrating Auth0 integration, using the Auth0 Laravel SDK.","archived":false,"fork":false,"pushed_at":"2024-07-25T15:07:32.000Z","size":7604,"stargazers_count":45,"open_issues_count":1,"forks_count":58,"subscribers_count":33,"default_branch":"7.x","last_synced_at":"2025-06-25T20:04:44.849Z","etag":null,"topics":["auth0","authorization","dx-sdk-quickstart","laravel","php","quickstart","webapp"],"latest_commit_sha":null,"homepage":"https://github.com/auth0/laravel-auth0","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/auth0-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-05-20T22:02:20.000Z","updated_at":"2025-03-31T10:51:03.000Z","dependencies_parsed_at":"2024-02-08T20:02:44.801Z","dependency_job_id":null,"html_url":"https://github.com/auth0-samples/laravel","commit_stats":null,"previous_names":["auth0-samples/laravel","auth0-samples/auth0-laravel-php-web-app"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/auth0-samples/laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Flaravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Flaravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Flaravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Flaravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/auth0-samples","download_url":"https://codeload.github.com/auth0-samples/laravel/tar.gz/refs/heads/7.x","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/auth0-samples%2Flaravel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265893936,"owners_count":23845183,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth0","authorization","dx-sdk-quickstart","laravel","php","quickstart","webapp"],"created_at":"2025-07-19T05:32:00.749Z","updated_at":"2025-10-16T01:47:47.272Z","avatar_url":"https://github.com/auth0-samples.png","language":"PHP","readme":"![Auth0 Laravel SDK](https://cdn.auth0.com/website/sdks/banners/laravel-auth0-banner.png)\n\n:books: [Documentation](#documentation) — :rocket: [Getting Started](#getting-started) — :round_pushpin: [Routes](#demonstration-routes) — :wrench: [Default Changes](#changes-to-the-default-laravel-application)\n\nThis is a sample project demonstrating how to integrate [the Auth0 Laravel SDK](https://github.com/auth0/laravel-auth0) into a Laravel 9 application. For Laravel 10 applications, the integration steps are identical.\n\n## Documentation\n\nGuidance on integrating Auth0 into your Laravel application can be found here:\n\n- [Auth0 Laravel SDK Readme](https://github.com/auth0/laravel-auth0/blob/master/README.md)\n- [Auth0 Laravel SDK Session Authentication Quickstart](https://auth0.com/docs/quickstart/webapp/laravel)\n- [Auth0 Laravel SDK Token Authorization Quickstart](https://auth0.com/docs/quickstart/backend/laravel)\n\nYou may also find the following documentation from the SDK's GitHub repository useful:\n\n- [docs/Configuration](https://github.com/auth0/laravel-auth0/blob/master/docs/Configuration.md)\n- [docs/Events](https://github.com/auth0/laravel-auth0/blob/master/docs/Events.md)\n- [docs/Installation](https://github.com/auth0/laravel-auth0/blob/master/docs/Installation.md)\n- [docs/Management](https://github.com/auth0/laravel-auth0/blob/master/docs/Management.md)\n- [docs/Users](https://github.com/auth0/laravel-auth0/blob/master/docs/Users.md)\n\n## Getting Started\n\nUse Composer's `create-project` command to clone this repository and install the dependencies:\n\n```bash\ncomposer create-project auth0-samples/laravel auth0-laravel-quickstart \u0026\u0026 cd auth0-laravel-quickstart\n```\n\nAuthenticate with Auth0 using the bundled Auth0 CLI:\n\n```bash\n./auth0 login\n```\n\n\u003e **Note**  \n\u003e Authenticate as a \"user\" if prompted.\n\nCreate an Auth0 Application:\n\n```bash\n./auth0 apps create \\\n  --name \"My Laravel Backend\" \\\n  --type \"regular\" \\\n  --auth-method \"post\" \\\n  --callbacks \"http://localhost:8000/callback\" \\\n  --logout-urls \"http://localhost:8000\" \\\n  --reveal-secrets \\\n  --no-input \\\n  --json \u003e .auth0.app.json\n```\n\nCreate an Auth0 API:\n\n```bash\n./auth0 apis create \\\n  --name \"My Laravel Backend API\" \\\n  --identifier \"https://github.com/auth0/laravel-auth0\" \\\n  --offline-access \\\n  --no-input \\\n  --json \u003e .auth0.api.json\n```\n\nRun the application:\n\n```\nphp artisan serve\n```\n\n## Demonstration Routes\n\nThis sample includes a few demonstration routes to help you get started.\n\n### Session-Based Authentication\n\nThe SDK automatically registers the following routes for session-based authentication:\n\n| Method | Route                                        | Description                                                                                                |\n| ------ | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------- |\n| GET    | [/login](https://localhost:8000/login)       | Starts the user authentication flow. Sets up some initial cookies, and redirects to Auth0 to authenticate. |\n| GET    | [/callback](https://localhost:8000/callback) | Handles the return callback from Auth0. Completes setting up the user's Laravel session.                   |\n| GET    | [/logout](https://localhost:8000/logout)     | Logs the user out.                                                                                         |\n\nThe `routes/web.php` file contains routes that demonstrate working with session-based authentication. These are:\n\n| Method | Route                                      | Description                                                     |\n| ------ | ------------------------------------------ | --------------------------------------------------------------- |\n| GET    | [/private](https://localhost:8000/private) | Demonstrates how to protect a route with the `auth` middleware. |\n| GET    | [/scope](https://localhost:8000/scope)     | Demonstrates how to protect a route with the `can` middleware.  |\n| GET    | [/colors](https://localhost:8000/colors)   | Demonstrates how to make Management API calls.                  |\n\n### Token-Based Authorization\n\nThe `routes/api.php` file contains routes that demonstrate token-based authorization. These are:\n\n| Method | Route                                              | Description                                                          |\n| ------ | -------------------------------------------------- | -------------------------------------------------------------------- |\n| GET    | [/api](https://localhost:8000/api)                 | Demonstrates how to extract information from the request token.      |\n| GET    | [/api/private](https://localhost:8000/api/private) | Demonstrates how to protect an API route with the `auth` middleware. |\n| GET    | [/api/scope](https://localhost:8000/api/scope)     | Demonstrates how to protect an API route with the `can` middleware.  |\n| GET    | [/api/me](https://localhost:8000/api/me)           | Demonstrates how to make Management API calls.                       |\n\n## Changes to the Default Laravel Application\n\nThis sample is based on [the default Laravel application](https://github.com/laravel/laravel) you can [create](https://laravel.com/docs/9.x/installation#your-first-laravel-project) using `laravel new` or `composer create-project`.\n\n\u003e **Note**  \n\u003e For Laravel 10, use `composer create-project laravel/laravel:^10.0` and follow the same steps outlined below.\n\nFew changes are necessary to get started, as the SDK automatically sets up all the necessary guards, middleware and other services necessary to support authentication and authorization. The following is a list of changes that have been applied:\n\n- The `auth0/login` package has been added to the `composer.json` file, using:\n\n    ```bash\n    composer require auth0/login:^7.8 --update-with-all-dependencies\n    ```\n\n- The `config/auth0.php` file was generated, using:\n\n    ```bash\n    php artisan vendor:publish --tag auth0\n    ```\n\n- The `routes/web.php` file was updated to include the demonstration routes.\n- The `routes/api.php` file was updated to include the demonstration routes.\n\n## Feedback\n\nWe appreciate your feedback! Please create an issue in this repository or reach out to us on [Community](https://community.auth0.com/).\n\n## Vulnerability Reporting\n\nPlease do not report security vulnerabilities on the public GitHub issue tracker. The [Responsible Disclosure Program](https://auth0.com/whitehat) details the procedure for disclosing security issues.\n\n## What is Auth0?\n\nAuth0 helps you to easily:\n\n- implement authentication with multiple identity providers, including social (e.g., Google, Facebook, Microsoft, LinkedIn, GitHub, Twitter, etc), or enterprise (e.g., Windows Azure AD, Google Apps, Active Directory, ADFS, SAML, etc.)\n- log in users with username/password databases, passwordless, or multi-factor authentication\n- link multiple user accounts together\n- generate signed JSON Web Tokens to authorize your API calls and flow the user identity securely\n- access demographics and analytics detailing how, when, and where users are logging in\n- enrich user profiles from other data sources using customizable JavaScript rules\n\n[Why Auth0?](https://auth0.com/why-auth0)\n\n## License\n\nThis project is licensed under the MIT license. See the [LICENSE](./LICENSE) file for more info.\n","funding_links":[],"categories":["Projects Using Auth0"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0-samples%2Flaravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fauth0-samples%2Flaravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fauth0-samples%2Flaravel/lists"}