Skip to content

Commit

Permalink
[FIX] auth_jwt: Unhandled PyJWKClientError in _get_key
Browse files Browse the repository at this point in the history
This breaks the validation loop with next_validator_id
  • Loading branch information
paradoxxxzero committed Mar 15, 2024
1 parent a0ff28d commit 77df6d8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion auth_jwt/models/auth_jwt_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,10 @@ def _decode(self, token, secret=None):
else:
try:
header = jwt.get_unverified_header(token)
key = self._get_key(header.get("kid")) # Can raise PyJWKClientError

Check warning on line 192 in auth_jwt/models/auth_jwt_validator.py

View check run for this annotation

Codecov / codecov/patch

auth_jwt/models/auth_jwt_validator.py#L192

Added line #L192 was not covered by tests
except Exception as e:
_logger.info("Invalid token: %s", e)
raise UnauthorizedInvalidToken() from e
key = self._get_key(header.get("kid"))
algorithm = self.public_key_algorithm
try:
payload = jwt.decode(
Expand Down

0 comments on commit 77df6d8

Please sign in to comment.