log original error when token decoding fails w/ burnettk
This commit is contained in:
parent
40af8809a1
commit
c6f0dd65e5
|
@ -420,17 +420,18 @@ 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
|
||||||
|
|
||||||
|
if "iss" in decoded_token:
|
||||||
|
return decoded_token
|
||||||
else:
|
else:
|
||||||
if "iss" in decoded_token:
|
current_app.logger.error(f"Unknown token type in get_decoded_token: token: {token}")
|
||||||
return decoded_token
|
raise ApiError(
|
||||||
else:
|
error_code="unknown_token",
|
||||||
current_app.logger.error(f"Unknown token type in get_decoded_token: token: {token}")
|
message="Unknown token type in get_decoded_token",
|
||||||
raise ApiError(
|
)
|
||||||
error_code="unknown_token",
|
|
||||||
message="Unknown token type in get_decoded_token",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _get_authentication_identifier_from_request() -> str:
|
def _get_authentication_identifier_from_request() -> str:
|
||||||
|
|
Loading…
Reference in New Issue