From fc6a95995983de6e47cd3fdef33cb5dd3f86a4e4 Mon Sep 17 00:00:00 2001 From: april Date: Wed, 3 Jan 2024 08:38:40 -0600 Subject: [PATCH] Change login error codes --- api/app/deps.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/api/app/deps.py b/api/app/deps.py index 3c18247..193fd25 100644 --- a/api/app/deps.py +++ b/api/app/deps.py @@ -29,11 +29,11 @@ async def get_current_user(settings: Annotated[Settings, Depends(get_settings)], if datetime.fromtimestamp(token_data.exp) < datetime.now(): raise HTTPException(401, "Token expired", {"WWW-Authenticate": "Bearer"}) except (jwt.JWTError, ValidationError): - raise HTTPException(403, "Could not validate credentials", {"WWW-Authenticate": "Bearer"}) + raise HTTPException(401, "Could not validate credentials", {"WWW-Authenticate": "Bearer"}) blacklisted = await is_blacklisted(token) if blacklisted: - raise HTTPException(403, "Token expired", {"WWW-Authenticate": "Bearer"}) + raise HTTPException(401, "Token expired", {"WWW-Authenticate": "Bearer"}) user = await get_user_system_info_id(id=token_data.sub) if user is None: @@ -53,11 +53,11 @@ async def get_current_user_token(settings: Annotated[Settings, Depends(get_setti if datetime.fromtimestamp(token_data.exp) < datetime.now(): raise HTTPException(401, "Token expired", {"WWW-Authenticate": "Bearer"}) except (jwt.JWTError, ValidationError): - raise HTTPException(403, "Could not validate credentials", {"WWW-Authenticate": "Bearer"}) + raise HTTPException(401, "Could not validate credentials", {"WWW-Authenticate": "Bearer"}) blacklisted = await is_blacklisted(token) if blacklisted: - raise HTTPException(403, "Token expired", {"WWW-Authenticate": "Bearer"}) + raise HTTPException(401, "Token expired", {"WWW-Authenticate": "Bearer"}) user = await get_user_system_info_id(id=token_data.sub) if user is None: