log original error when token decoding fails w/ burnettk

This commit is contained in:
jasquat 2024-04-25 12:19:45 -04:00
parent 40af8809a1
commit c6f0dd65e5
No known key found for this signature in database
1 changed files with 9 additions and 8 deletions

View File

@ -420,9 +420,10 @@ def _get_decoded_token(token: str) -> dict:
try: try:
decoded_token: dict = AuthenticationService.parse_jwt_token(_get_authentication_identifier_from_request(), token) decoded_token: dict = AuthenticationService.parse_jwt_token(_get_authentication_identifier_from_request(), token)
except Exception as e: except Exception as e:
current_app.logger.warning(f"Received exception when attempting to decode token: {e.__class__.__name__}: {str(e)}")
AuthenticationService.set_user_has_logged_out() AuthenticationService.set_user_has_logged_out()
raise ApiError(error_code="invalid_token", message="Cannot decode token.", status_code=401) from e raise ApiError(error_code="invalid_token", message="Cannot decode token.", status_code=401) from e
else:
if "iss" in decoded_token: if "iss" in decoded_token:
return decoded_token return decoded_token
else: else: