aiohttp-basicauth
Proxy connector for aiohttp
What it is and what it does
aiohttp-basicauth is a middleware for aiohttp that adds HTTP basic authentication to your async web application. It intercepts requests and validates credentials against a username and password you provide, returning an error response if authentication fails. You can apply it globally to all routes or selectively to specific views using a decorator.
The package is lightweight and depends only on aiohttp. It supports both simple static credentials and custom verification logic by subclassing and overriding the check_credentials method, making it suitable for scenarios ranging from development servers to applications with dynamic user stores.
Use it for:
- Protect all routes in a development or internal API with a single username and password
- Selectively require authentication on specific endpoints while leaving others public
- Implement custom authentication logic by subclassing and querying a database for user credentials
- Add basic auth to microservices or internal tools that need simple credential validation
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Provides HTTP basic authentication middleware for aiohttp applications, allowing you to protect routes with username and password credentials.
Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a straightforward problem for aiohttp users. Use it when you need basic HTTP authentication without the complexity of OAuth or session management.
Install
aiohttp-basicauth on PyPI
pip
pip install aiohttp-basicauthuv
uv add aiohttp-basicauthpoetry
poetry add aiohttp-basicauthInstalling aiohttp-basicauth
Before you install
Low friction installation with a single dependency on aiohttp. Actively maintained with recent releases and a stable codebase.
License in practice
Apache-2.0 is permissive; you can use this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install aiohttp-basicauth
from aiohttp import web
from aiohttp_basicauth import BasicAuthMiddleware
auth = BasicAuthMiddleware(username='user', password='password')
app = web.Application(middlewares=[auth])
web.run_app(app, host='127.0.0.1', port=80)
Requires aiohttp >= 3.10 and Python >= 3.8
Verify before relying
- Whether the package supports custom credential backends (e.g., database lookups) beyond the check_credentials override pattern shown in the description
- What HTTP status code is returned when authentication fails
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.8.0) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — aiohttp |
| Maintenance | actively maintained — 70 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 78,062/month — #14,471 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiohttp_basicauth-1.2.0-py3-none-any.whl
Keywords: asyncio, aiohttp, http, auth, basic auth
Tags
More WWW/HTTP packages
urllib3 is an HTTP client library that provides…
permissive · top 100 on PyPI
requestsRequests is a Python HTTP library that…
permissive · top 100 on PyPI
h11h11 is a pure-Python HTTP/1.1 protocol…
permissive · top 100 on PyPI
httpxHTTPX is a fully featured HTTP client library…
permissive · top 100 on PyPI
httpcoreA minimal low-level HTTP client library that…
permissive · top 100 on PyPI
aiohttpaiohttp is an async HTTP client and server…
permissive · top 100 on PyPI
aiohttp-middlewaresProvides a collection of ready-to-use…
permissive · top 15,000 on PyPI
Flask-BasicAuthFlask-BasicAuth adds HTTP basic access…
permissive · top 15,000 on PyPI
Flask-HTTPAuthAdds HTTP Basic, Digest, and Token…
permissive · top 5,000 on PyPI
aiohttp_socksProvides a proxy connector for aiohttp that…
permissive · top 5,000 on PyPI
aiohttp-sessionProvides session management for aiohttp.web…
permissive · top 15,000 on PyPI
aiohttp-corsAdds Cross-Origin Resource Sharing (CORS)…
permissive · top 5,000 on PyPI
Flask-CognitoFlask-Cognito integrates AWS Cognito JWT…
permissive · top 15,000 on PyPI
pytest-aiohttpPytest plugin that provides fixtures for…
permissive · top 5,000 on PyPI