Authlib implements OAuth 1.0, OAuth 2.0, OpenID Connect, and JWS/JWE/JWT for Python 3.10+. It ships clients and server helpers for Flask, Django, and async Python web stacks.
Overview
Authlib is a Python library for building OAuth and OpenID Connect clients, authorization servers, and resource APIs. It documents spec coverage across core OAuth flows, token profiles, and Javascript Object Signing and Encryption algorithms.
Integration modules cover Requests, HTTPX, Flask, Django, Starlette, and FastAPI for client login and token handling. Server-side helpers let applications issue and validate tokens and protect routes with bearer scope checks.
The Authlib project family also points to joserfc for new JOSE work and otpauth for HOTP and TOTP. Public adopters cited on the site include Gradio, Open WebUI, Canaille, and uData.
BSD licensing is available for open or closed source use, with optional commercial licenses. The authlib.jose module is slated for deprecation in favor of joserfc.
Key features
- OAuth 1.0 and 2.0 clients
- OpenID Connect support
- Authorization server primitives
- Flask and Django integrations
- FastAPI resource protection
- JOSE and JWT handling
- HTTPX async clients
Use cases
- Social and SSO login
- Self-hosted OAuth providers
- Bearer-protected APIs