A minimal Flask application demonstrating Auth0 authentication with cookie-based session persistence.
- Install dependencies:
uv sync- Fill in your Auth0 credentials in the
.envfile:
AUTH0_DOMAIN=your-tenant.auth0.com
AUTH0_CLIENT_ID=your-client-id
AUTH0_CLIENT_SECRET=your-client-secret
AUTH0_SECRET=<openssl rand -hex 32>
APP_BASE_URL=http://localhost:5000
-
In your Auth0 Dashboard, configure your application:
- Allowed Callback URLs:
http://localhost:5000/callback - Allowed Logout URLs:
http://localhost:5000
- Allowed Callback URLs:
-
Run the app:
uv run python server.py/— Shows login/signup links, or user profile if authenticated/login— Redirects to Auth0 Universal Login/callback— Handles the OAuth2 callback/logout— Clears session and redirects to Auth0 logout