--- id: aiohttp-basicauth version: "1.2.0" license: Apache-2.0 license_treatment: permissive maintenance: active --- # aiohttp-basicauth — Proxy connector for aiohttp License: permissive · Maintenance: active · Downloads: 78.1K/mo ## 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 above — 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 pip install aiohttp-basicauth uv add aiohttp-basicauth poetry add aiohttp-basicauth ## Installing 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_current - Install friction: low - Maintenance: active - Downloads: 78.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags aiohttp basic auth middleware, http basic authentication async, aiohttp route protection, basic auth aiohttp, async http authentication, authentication, middleware [View on SkillFed](https://skillfed.io/packages/aiohttp-basicauth) · [View on PyPI](https://pypi.org/project/aiohttp-basicauth/)