refactor: Improve JWT error logging for better debugging of authentication issues (#5885)

fix: improve JWT error logging for better debugging of authentication issues
This commit is contained in:
Gabriel Luiz Freitas Almeida 2025-01-29 00:04:35 -03:00 • committed by GitHub
commit 3e2e2cecbb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -136,7 +136,7 @@ async def get_current_user_by_jwt(
headers={"WWW-Authenticate": "Bearer"}, headers={"WWW-Authenticate": "Bearer"},
) )
except JWTError as e: except JWTError as e:
logger.exception("JWT decoding error") logger.debug("JWT validation failed: Invalid token format or signature")
raise HTTPException( raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Could not validate credentials", detail="Could not validate credentials",