summaryrefslogtreecommitdiff
path: root/jwt/api_jwk.py
diff options
context:
space:
mode:
Diffstat (limited to 'jwt/api_jwk.py')
-rw-r--r--jwt/api_jwk.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/jwt/api_jwk.py b/jwt/api_jwk.py
index 31250d5..aae2cf1 100644
--- a/jwt/api_jwk.py
+++ b/jwt/api_jwk.py
@@ -84,7 +84,14 @@ class PyJWKSet:
raise PyJWKSetError("The JWK Set did not contain any keys")
for key in keys:
- self.keys.append(PyJWK(key))
+ try:
+ self.keys.append(PyJWK(key))
+ except PyJWKError:
+ # skip unusable keys
+ continue
+
+ if len(self.keys) == 0:
+ raise PyJWKSetError("The JWK Set did not contain any usable keys")
@staticmethod
def from_dict(obj):