Auth
login_access_token(form_data, auth_service)
async
OAuth2 compatible token login, get an access token for future requests.
Security: - Uses strict OAuth2 form (username/password). - Rate Limiting should be applied at Gateway/Nginx level or via Middleware.
Parameters:
-
form_data(Annotated[OAuth2PasswordRequestForm, Depends()]) –OAuth2 password request form containing username and password.
-
auth_service(Annotated[AuthService, Depends(get_auth_service)]) –Injected authentication service.
Returns:
-
Token(Token) –A Token object containing the access token and token type.
Raises:
-
FunctionalError–If authentication fails due to invalid credentials or inactive user.
-
TechnicalError–If an unexpected error occurs during authentication.
Source code in app/api/v1/endpoints/auth.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | |