http://localhost:3000/callback
.http://localhost:3000
.requirements.txt
file in your project directory:.env
file in your project directory. This file will hold your client keys and other
configuration details.APP_SECRET_KEY
using openssl rand -hex 32
from your shell.server.py
file in your project directory - this file will
contain your application logic.Import all the libraries your application needs.Load the configuration .env
file you made in the previous step.Configure Authlib to handle your application’s authentication with Auth0. To learn more about the configuration
options available for Authlib’s OAuth register()
method from their documentation./login
route, your application will route them to the Auth0
login page.After your users log in with Auth0, your application will route them to the /callback
route. This
route saves the session for the user and bypasses the need for them to login again when they return.The /logout
route signs users out from your application. This route clears the user session in your
app and redirects to the Auth0 logout endpoint to ensure the session is no longer saved. Then, the application
redirects the user to your home route.Your /
home route either renders an authenticated user’s details or allows visitors to sign in.render_template()
calls).Create a new sub-directory in your project folder named templates
, and create home.html
in the directory. Paste the content from the right into that file.