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,17 +420,18 @@ def _get_decoded_token(token: str) -> dict:
try:
decoded_token: dict = AuthenticationService.parse_jwt_token(_get_authentication_identifier_from_request(), token)
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()
raise ApiError(error_code="invalid_token", message="Cannot decode token.", status_code=401) from e
if "iss" in decoded_token:
return decoded_token
else:
if "iss" in decoded_token:
return decoded_token
else:
current_app.logger.error(f"Unknown token type in get_decoded_token: token: {token}")
raise ApiError(
error_code="unknown_token",
message="Unknown token type in get_decoded_token",
)
current_app.logger.error(f"Unknown token type in get_decoded_token: token: {token}")
raise ApiError(
error_code="unknown_token",
message="Unknown token type in get_decoded_token",
)
def _get_authentication_identifier_from_request() -> str: