Overview

FastAPI-Users 13.0, released on June 1, 2024, is compatible with FastAPI 0.110+ and modernizes user management.

Main Features

FastAPI 0.110+

Compatibility with FastAPI 0.110+ integrates lifespan events and the latest framework improvements.

python
from fastapi_users import FastAPIUsers
from fastapi_users.authentication import (
    BearerTransport,
    JWTStrategy,
    AuthenticationBackend,
)

bearer_transport = BearerTransport(tokenUrl='auth/jwt/login')

def get_jwt_strategy() -> JWTStrategy:
    return JWTStrategy(secret='SECRET', lifetime_seconds=3600)

auth_backend = AuthenticationBackend(
    name='jwt',
    transport=bearer_transport,
    get_strategy=get_jwt_strategy,
)

Sources