FastAPI · Class
OAuth2PasswordBearer
OAuth2PasswordBearer reads a Bearer token from the Authorization header. Use it as a FastAPI dependency to protect endpoints and document the OAuth2 scheme in OpenAPI.
Last updated
Syntax
OAuth2PasswordBearer(tokenUrl, scheme_name=None, scopes=None, description=None, auto_error=True, refreshUrl=None)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
OAuth2PasswordRequestFormOAuth2PasswordRequestFormStrictOAuth2SecurityBaseDependsSecurityScopes