Skip to content

mckola/symfony-authorization

 
 

Repository files navigation

Learn how to build your first Symfony application and add authentication to it

Read the full tutorial here:

Creating your First Symfony App and Adding Authentication

This application detailed the step by step guide on how to build your first Symfony application and add authentication to it using Auth0.

Technology

This demo uses:

Running the demo

To run the demo follow these steps:

  1. Running git clone https://github.com/auth0-blog/symfony-authorization.git
  2. Run composer install to install all the project's dependencies.
  3. If you do not have an Auth0 account, sign up for one now. Navigate to the Auth0 management dashboard, select Applications from the navigation menu, then select or create a regular web application that you want to connect with Symfony
  4. Create a .env file within the root folder of the project and include your Auth0 credentials as well as your proposed database details:
DATABASE_URL=mysql:https://db_user:[email protected]:3306/db_name?serverVersion=5.7

Update this line with your own credentials and the name you want to use for the database, e.g. techcompanies. If you don't have MySQL installed and set up on your system, follow this guide to get started.

  • db_user: Replace with your database username
  • db_password: Replace with your database password
  • _db_name: Replace with your database name. You don't have to create the database yet, as we'll do that in the next step.

Next, add your Auth0 credentials:

AUTH0_CLIENT_ID=AUTH0_CLIENT_ID
AUTH0_CLIENT_SECRET=AUTH0_CLIENT_SECRET
AUTH0_DOMAIN=AUTH0_DOMAIN
  1. Next, run the following command to create a database with the value of your database name:
php bin/console doctrine:database:create

And this to create your database table:

php bin/console doctrine:schema:update --force
  1. Head over to your Auth0 dashboard and register Allowed Callback URLs as http:https://127.0.0.1:8000/auth0/callback and Allowed Logout URLs as http:https://127.0.0.1:8000/auth0/logout respectively.
  1. Finally run the application with:
php bin/console server:run

Useful links

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 71.4%
  • HTML 28.6%