HTTPX OAuth
Async OAuth2 client for Python built on HTTPX with ready-made provider clients.
Repository Health
Technical Analysis
HTTPX OAuth is an asynchronous OAuth2 client library for Python, built on top of the modern HTTPX HTTP client. It provides a generic OAuth2 base class for implementing any authorization-code flow, plus a collection of prebuilt clients for popular identity providers such as Google, GitHub, Microsoft, Discord, LinkedIn, Facebook, Okta, and generic OpenID Connect.
Designed to be async-first, it handles authorization URL generation, token exchange, token refresh and revocation, and retrieval of the authenticated user’s id and email. It also ships a FastAPI integration, making it a common building block for authentication flows in async Python web applications — including as the OAuth backbone of the FastAPI Users project.
What You Get
- A generic async OAuth2 base client for any authorization-code provider
- Prebuilt clients for Google, GitHub, Microsoft, Discord, LinkedIn, and more
- Generic OpenID Connect client support
- Token exchange, refresh, and revocation helpers
- Retrieval of the authenticated user’s id and email
- A first-class FastAPI integration
Common Use Cases
- Adding social login (Google, GitHub, etc.) to an async Python web app
- Implementing OAuth2 authorization-code flows in FastAPI applications
- Refreshing and revoking access tokens for third-party API access
- Building a custom provider client on top of the generic OAuth2 base
Under The Hood
Architecture - The core is oauth2.py, which defines a BaseOAuth2 class implementing the authorization-code flow: building authorization URLs, exchanging codes at the token endpoint, refreshing and revoking tokens, and surfacing typed errors from exceptions.py. Provider-specific subclasses live under httpx_oauth/clients/ (google.py, github.py, microsoft.py, discord.py, openid.py, and others), each customizing endpoints and profile retrieval. Framework glue lives under httpx_oauth/integrations/ (fastapi.py).
Tech Stack - Pure async Python (>=3.9 era) built on HTTPX for transport, fully type-annotated (ships py.typed), managed with pyproject.toml and uv, and documented with MkDocs. It uses just as a task runner.
Code Quality - The library is well-tested with a dedicated tests/ suite and codecov coverage tracking, and it is battle-tested as a dependency of FastAPI Users. Concerns are cleanly separated between the generic flow, per-provider clients, and framework integrations.
API Design - The API is compact and consistent: instantiate a client with credentials, then call get_authorization_url, get_access_token, refresh_token, or get_id_email. Provider clients share the same interface, so switching or supporting multiple providers requires minimal code, and the FastAPI integration reduces boilerplate to a dependency.
Used by 2 apps in this directory
Paperless-ngx
Bookmarks Archiving
Turn your paper pile into a searchable digital archive with OCR, AI classification, and automated workflows — all running on your own server.
Polar
Ecommerce · Developer Tools · Invoicing Finance
Open source payments infrastructure that turns software into a business — subscriptions, usage-based billing, digital products, and merchant-of-record compliance in one platform.