FastAPI Users adds customizable user models, registration, login, password reset, email verification, OAuth2, and pluggable auth backends to FastAPI applications.
Overview
FastAPI Users is a Python library that wires user management into FastAPI projects without reinventing common auth flows. It supplies an extensible user model, ready-made routes for register, login, password reset, and email verification, plus dependency helpers to inject the current user into endpoints.
Authentication backends can mix JWT, database, or Redis strategies and header or cookie transports, with OpenAPI schema support across multiple backends. Social OAuth2 login flows and pluggable password validation are included, and database integration is swappable.
The maintainers note the project is in maintenance mode with security and dependency updates but no new features, while a successor authentication toolkit is being developed separately.
Documentation walks through configuration, routers, managers, and migration guides between major versions for existing adopters.
Key features
- Register and login routes
- Password reset and verify email
- OAuth2 social login flow
- JWT database Redis strategies
- Cookie or header transports
- Pluggable password validators
- Customizable database backends
- OpenAPI multi-backend schemas
Use cases
- Adding auth to FastAPI APIs
- Cookie-based web sessions
- OAuth login buttons
- Multi-backend JWT APIs