From f60ee4b9101edbd7b41cd5651c69890796edc80c Mon Sep 17 00:00:00 2001 From: Tim Waterson Date: Thu, 2 Mar 2023 10:20:35 +0000 Subject: [PATCH] Fix for issue #862 - ignore invalid keys in a jwks. --- jwt/api_jwk.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jwt/api_jwk.py b/jwt/api_jwk.py index fdcde21a..b95ac014 100644 --- a/jwt/api_jwk.py +++ b/jwt/api_jwk.py @@ -5,7 +5,7 @@ from typing import Any, Optional from .algorithms import get_default_algorithms, has_crypto, requires_cryptography -from .exceptions import InvalidKeyError, PyJWKError, PyJWKSetError +from .exceptions import InvalidKeyError, PyJWKError, PyJWKSetError, PyJWTError from .types import JWKDict @@ -94,7 +94,7 @@ def __init__(self, keys: list[JWKDict]) -> None: for key in keys: try: self.keys.append(PyJWK(key)) - except PyJWKError: + except PyJWTError: # skip unusable keys continue