skillfed

fastapi-auth0

Easy auth0.com integration for FastAPI

fastapi-auth0 v0.5.0 130.4K downloads/30d#11,642 on PyPI236
Permissive license MIT DORMANT released

What it is and what it does

fastapi-auth0 is a lightweight wrapper that connects FastAPI applications to Auth0's identity platform. It handles OAuth2 implicit flow authentication and automatically generates Swagger UI login controls, so users can sign in via social providers directly from the API documentation without requiring custom frontend code.

The package provides an Auth0 class that manages authentication state and a Security dependency for protecting routes. It extracts user identity, permissions, and optionally email from Auth0 tokens and makes them available as Auth0User objects in your route handlers. Setup requires configuring your Auth0 tenant with the correct scopes and callback URLs, but once done, adding authentication to a route is a single-line dependency injection.

Use it for:

  • Protect FastAPI endpoints with Auth0 authentication and scope-based authorization without writing custom OAuth2 logic.
  • Enable users to log in via social providers directly from Swagger UI interactive documentation.
  • Extract user identity and permissions from Auth0 tokens to enforce fine-grained access control in API routes.
  • Build applications where Auth0 manages user identity and role assignment across organizations.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Integrates Auth0 authentication into FastAPI applications with automatic Swagger UI support for OAuth2 implicit flow, enabling social provider login without additional code.

Yes, if you are already committed to Auth0 and FastAPI and need quick OAuth2 integration with Swagger UI support. No, if you require active maintenance, recent bug fixes, or compatibility with the latest FastAPI versions—the package has been dormant since late 2023 and may lag behind framework updates. Consider it a stable but unsupported tool suitable for mature, low-change applications.

Install

fastapi-auth0 on PyPI

pip

pip install fastapi-auth0

uv

uv add fastapi-auth0

poetry

poetry add fastapi-auth0

Installing fastapi-auth0

Before you install

Low install friction with only two runtime dependencies (fastapi and python-jose). However, the package is dormant—last release was 2023-09-17 and no commits since 2024-12-16, so maintenance is minimal and bug fixes or compatibility updates are unlikely.

License in practice

MIT license is permissive, allowing free use, modification, and distribution with minimal restrictions—suitable for both open-source and commercial projects.

Quickstart

pip install fastapi-auth0

from fastapi import FastAPI, Depends, Security
from fastapi_auth0 import Auth0, Auth0User

auth = Auth0(domain='your-tenant.auth0.com', api_audience='your-api-identifier', scopes={'read:blabla': ''})
app = FastAPI()

@app.get("/secure", dependencies=[Depends(auth.implicit_scheme)])
def get_secure(user: Auth0User = Security(auth.get_user, scopes=['read:blabla'])):
    return {"message": f"{user}"}

Auth0 tenant must be configured with correct scopes and callback URL (http://localhost:8000/docs/oauth2-redirect for Swagger UI). Email field requires 'openid profile email' permission and 'Add email to access token' rule in Auth0.

Verify before relying

  • Whether the package remains compatible with current FastAPI and Auth0 API versions given its dormant maintenance status
  • Performance characteristics when handling high volumes of concurrent authentication requests
  • Whether email field extraction works reliably across all Auth0 tenant configurations

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 2 — fastapi, python-jose
Maintenance dormant — 1,062 days since the last release
Last repo commit
First released
Downloads 130,397/month — #11,642 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: fastapi_auth0-0.5.0-py3-none-any.whl

Tags

auth0 fastapi integrationoauth2 implicit flow fastapifastapi authentication auth0social login fastapiswagger ui oauth2 fastapifastapi auth0 user management
oauth2identity-management

More WWW/HTTP packages