Authlib

AuthlibPython 3.10+BSD-3-Clause

OAuth and OpenID Connect for Python.

Build OAuth clients, authorization servers, and protected APIs with protocol implementations that connect cleanly to the Python frameworks you already use.

$pip install Authlib
OpenID Connect loginauthlib
from authlib.integrations.flask_client import OAuth

oauth = OAuth(app)
provider = oauth.register(
    "provider", server_metadata_url=metadata_url
)
return provider.authorize_redirect(redirect_uri)
Read the client guide

Projects with clear boundaries.

Install only the protocol surface your application needs. Each package has a focused API and its own documentation.

01

Authlib

OAuth and OpenID Connect
pip install Authlib

Clients, authorization servers, and resource servers for OAuth 1.0, OAuth 2.0, and OpenID Connect.

02

joserfc

JOSE and JWT
pip install joserfc

A standalone, type-hinted implementation of JWS, JWE, JWK, JWA, and JWT.

03

OTP Auth

HOTP and TOTP
pip install otpauth

A focused package for generating and verifying HMAC-based and time-based one-time passwords.

Starting new JOSE work?Use joserfc. The authlib.jose module is deprecated in Authlib 1.7 and is being replaced by the standalone package.

Migration guide

One model across both sides of OAuth.

Authlib connects low-level protocol implementations to the Python frameworks where applications actually run. Start with an integration, then extend grants, endpoints, or validators when needed.

01

Consume a provider

HTTP clients, service accounts, and web application login flows.

02

Issue tokens

Grants, endpoints, metadata, and OpenID Connect provider primitives.

03

Protect resources

Bearer token validation, scopes, introspection, and API protection.

Framework integrations6 integrations
  • Requests
  • HTTPX
  • Starlette
  • FastAPI
  • Flask
  • Django
Protocol coverageOAuth + JOSE
  • OAuth 1.0
  • OAuth 2.0
  • OpenID Connect
  • JWS
  • JWE
  • JWK
  • JWA
  • JWT
Explore the full documentation

Releases, migrations, and protocol work.

Follow major releases, implementation guides, funded work, and changes across the Authlib project family.

Use Authlib freely. Fund the work when it matters.

The projects are BSD-licensed. Sponsorship and commercial support fund protocol review, releases, compatibility, and documentation.