From: Michael Tremer Date: Mon, 16 Jun 2025 16:57:05 +0000 (+0000) Subject: API: Automatically set a default value for the auth token type X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=096074dcb3cf5278c20c2322a0658eb3b8fe7b39;p=pbs.git API: Automatically set a default value for the auth token type Signed-off-by: Michael Tremer --- diff --git a/src/api/auth.py b/src/api/auth.py index 3bd8eb59..0cc0dfef 100644 --- a/src/api/auth.py +++ b/src/api/auth.py @@ -44,7 +44,7 @@ REFRESH_TOKEN_EXPIRY_TIME = datetime.timedelta(days=7) class AuthResponse(pydantic.BaseModel): # Token Type - type: str + type: str = "Bearer" # Access Token access_token: str @@ -103,8 +103,4 @@ async def auth_user(credentials: fastapi.security.OAuth2PasswordRequestForm = type="refresh", expires_after=REFRESH_TOKEN_EXPIRY_TIME) # Send the response - return AuthResponse( - type = "Bearer", - access_token = access_token, - refresh_token = refresh_token, - ) + return AuthResponse(access_token=access_token, refresh_token=refresh_token)