fastapi-cloudauth

raw JSON →
0.4.3 verified Fri May 01 auth: no python maintenance

FastAPI integration with cloud authentication services (AWS Cognito, Auth0, Firebase Authentication). Current version 0.4.3. Low release cadence, last release Dec 2021.

pip install fastapi-cloudauth
error ImportError: cannot import name 'Auth0' from 'fastapi_cloudauth'
cause Trying to import from the top-level package instead of submodule.
fix
Use: from fastapi_cloudauth.auth0 import Auth0
error AttributeError: 'NoneType' object has no attribute 'decode'
cause Invalid or expired token, or missing JWKS endpoint. Common with self-signed tokens.
fix
Verify your token is valid and the provider's JWKS URL is reachable. For local testing, ensure you use a real token.
error jose.exceptions.ExpiredSignatureError
cause Token has expired.
fix
Refresh the token or obtain a new one.
breaking v0.3.0 changed Auth0's default scope key from 'scope' to 'permissions'. If you rely on the old key, update your RBAC settings.
fix Ensure Auth0 RBAC settings are configured to use 'permissions' claim or explicitly set scope_key='scope' when creating Auth0 instance.
gotcha Importing from top-level 'fastapi_cloudauth' (e.g., `from fastapi_cloudauth import Auth0`) raises ImportError. Providers are in submodules.
fix Use correct submodule imports: `from fastapi_cloudauth.auth0 import Auth0`.
deprecated Library is in maintenance mode; no major updates since 2021. Not compatible with FastAPI 0.100+ (uses deprecated `jsonable_encoder` behavior).
fix Pin FastAPI to <0.100 or consider migration to alternative auth libraries (e.g., fastapi-jwt-auth).
pip install fastapi-cloudauth[firebase]

Basic Auth0 integration; replace domain and audience with your values.

from fastapi import FastAPI, Depends
from fastapi_cloudauth.auth0 import Auth0

app = FastAPI()
auth = Auth0(domain='your-domain.auth0.com', audience='your-audience')

@app.get("/secure")
def secure_route(user: dict = Depends(auth.get_user)):
    return {"user": user}