httpx-auth
Authentication for HTTPX
What it is and what it does
httpx-auth is an authentication layer for the httpx HTTP client library. It provides pre-built authentication classes that integrate directly with httpx's auth parameter, handling the complexity of token retrieval, refresh, and header formatting so you don't have to implement it yourself.
The package supports a wide range of authentication schemes: OAuth2 (Authorization Code, Authorization Code with PKCE, Resource Owner Password Credentials, Client Credentials, and Implicit flows), AWS Signature Version 4, API keys (in headers or query parameters), and basic authentication. It includes built-in support for specific providers like Okta, WakaTime, and Microsoft Entra. The single runtime dependency is httpx itself, and the package is typed for IDE support.
Use it for:
- Authenticate requests to OAuth2-protected APIs (Okta, Microsoft Entra, WakaTime) using Authorization Code flow with automatic token refresh.
- Sign AWS API requests with Signature Version 4 without manually computing signatures.
- Add API key authentication to httpx requests, either as a header or query parameter.
- Implement OAuth2 Client Credentials flow for service-to-service authentication.
- Combine multiple authentication methods in a single request when an API requires both.
- Persist and reuse OAuth2 tokens across multiple requests to avoid repeated authorization steps.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides authentication classes for httpx HTTP client requests, supporting OAuth2 flows, API keys, AWS signatures, and basic auth.
Yes. The package is Production/Stable, has no known vulnerabilities, low install friction, and solves a common problem—integrating authentication with httpx—without requiring you to implement token management yourself. The aging maintenance status (last commit 2026-01-05) is not a blocker for stable use, but monitor the repository for updates if you depend on new OAuth2 flows or provider support.
Install
httpx-auth on PyPI
pip
pip install httpx-authuv
uv add httpx-authpoetry
poetry add httpx-authInstalling httpx-auth
Before you install
Low install friction with a single runtime dependency (httpx). Maintenance status is aging—last commit was 2026-01-05 with 143 repository stars—but the package is marked Production/Stable and has been actively maintained since its first release in 2020-02-04.
License in practice
MIT License permits free use, modification, and distribution with minimal restrictions. You may use this in proprietary projects without obligation to share your code.
Quickstart
pip install httpx-auth
import httpx
from httpx_auth import OAuth2AuthorizationCode
with httpx.Client() as client:
client.get('https://www.example.com', auth=OAuth2AuthorizationCode('https://www.authorization.url', 'https://www.token.url'))
Requires Python 3.9 or later. OAuth2 flows that use browser-based authorization will open a local redirect server on port 5000 by default.
Verify before relying
- Whether token cache persistence works with all OAuth2 flows or has specific limitations.
- Current stability relative to httpx 1.0.0 release—the package notes it will reach 1.0.0 once httpx stabilizes.
Package facts
| License | MIT License Copyright (c) 2024 Colin Bounouar Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — httpx |
| Maintenance | aging — 584 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 2,256,935/month — #3,185 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: httpx_auth-0.23.1-py3-none-any.whl
Keywords: authentication, oauth2, aws, okta, aad, entra
Tags
More Build Tools packages
Provides reusable utilities for Python…
permissive · top 100 on PyPI
tqdmWraps any iterable to display a real-time…
copyleft · top 100 on PyPI
pippip is the standard installer for Python…
permissive · top 100 on PyPI
hatchlingHatchling is a standards-compliant Python build…
permissive · top 100 on PyPI
grpcio-toolsGenerates Python gRPC service stubs and message…
permissive · top 1,000 on PyPI
pre-commitpre-commit is a framework for installing and…
permissive · top 1,000 on PyPI
requests-authAdds OAuth2, API key, Basic, and NTLM…
permissive · top 15,000 on PyPI
mohawkMohawk implements the Hawk HTTP authorization…
copyleft · top 5,000 on PyPI
httpx-oauthProvides an async OAuth client built on HTTPX…
permissive · top 5,000 on PyPI
oauth2-clientHandles OAuth2 authentication flows…
unclear · top 15,000 on PyPI
requests-oauthlibAdds OAuth 1 and OAuth 2 authentication support…
permissive · top 1,000 on PyPI
httpx-ntlmAdds NTLM authentication support to HTTPX,…
permissive · top 15,000 on PyPI
requests-oauth2clientAn OAuth 2.x client for Python that obtains,…
permissive · top 5,000 on PyPI
google-auth-oauthlibIntegrates oauthlib with google-auth to handle…
permissive · top 1,000 on PyPI
oauth2Implements OAuth 1.0 authentication for Python…
permissive · top 15,000 on PyPI
requests-oauthAdds OAuth 1.0 authentication support to the…
permissive · top 5,000 on PyPI