{"id":23708,"library":"fastapi-auth0","title":"fastapi-auth0","description":"FastAPI-Auth0 is a library providing easy Auth0 integration for FastAPI applications. It offers dependency injection for verifying access tokens, including custom user models and role/permission checking. Current version is 0.5.0, with a moderate release cadence.","status":"active","version":"0.5.0","language":"python","source_language":"en","source_url":"https://github.com/dorinclisu/fastapi-auth0","tags":["fastapi","auth0","authentication","jwt","oauth2"],"install":[{"cmd":"pip install fastapi-auth0","lang":"bash","label":"PyPI"}],"dependencies":[{"reason":"Core framework","package":"fastapi","optional":false},{"reason":"Data validation","package":"pydantic","optional":false},{"reason":"JWT handling","package":"python-jose[cryptography]","optional":false},{"reason":"HTTP requests for JWKS","package":"httpx","optional":false}],"imports":[{"note":"Wrong package, causes ImportError.","wrong":"from auth0 import Auth0","symbol":"Auth0","correct":"from fastapi_auth0 import Auth0"},{"note":"","wrong":"","symbol":"Auth0User","correct":"from fastapi_auth0 import Auth0User"}],"quickstart":{"code":"from fastapi import FastAPI, Depends\nfrom fastapi_auth0 import Auth0, Auth0User\nimport os\n\napp = FastAPI()\nauth0_domain = os.environ.get('AUTH0_DOMAIN', '')\nauth0_api_audience = os.environ.get('AUTH0_API_AUDIENCE', '')\nauth0_issuer = f'https://{auth0_domain}/'\nauth = Auth0(domain=auth0_domain, api_audience=auth0_api_audience, issuer=auth0_issuer)\n\n@app.get('/public')\nasync def public():\n    return {'message': 'Hello public'}\n\n@app.get('/private')\nasync def private(user: Auth0User = Depends(auth.get_user)):\n    return {'message': f'Hello {user.email}'}","lang":"python","description":"Basic setup with public and private endpoints."},"warnings":[{"fix":"Catch Auth0UnauthenticatedException instead.","message":"Exception renamed from Auth0UnauthenticatedError to Auth0UnauthenticatedException in v0.2.0.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use Python 3.8 or higher.","message":"Support for Python 3.7 dropped in v0.5.0, though may still work.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Upgrade to v0.2.0+ or sanitize audience string.","message":"If audience contains URL-illegal characters (like spaces), JWT verification fails. Fixed in v0.2.0.","severity":"gotcha","affected_versions":"<0.2.0"},{"fix":"Upgrade to v0.3.0+.","message":"When using token from another tenant or with rotated keys, you get a misleading error message. Fixed in v0.3.0.","severity":"gotcha","affected_versions":"<0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use from fastapi_auth0 import Auth0","cause":"Importing from wrong module: from auth0 import Auth0 instead of from fastapi_auth0 import Auth0","error":"ImportError: cannot import name 'Auth0' from 'auth0'"},{"fix":"Catch Auth0UnauthenticatedException instead.","cause":"Exception was renamed in v0.2.0.","error":"AttributeError: module 'fastapi_auth0' has no attribute 'Auth0UnauthenticatedError'"},{"fix":"Ensure issuer URL in init matches exactly (typically ending with '/').","cause":"Issuer URL mismatch, often due to trailing slash differences.","error":"Auth0Error: The token's issuer is not valid. Expected 'https://your-domain.auth0.com/', got 'https://your-domain.auth0.com/'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}