Skip to content

Commit

Permalink
Fix Issue jpadilla#914
Browse files Browse the repository at this point in the history
Fix for jpadilla#914
  • Loading branch information
jaferrando authored Aug 30, 2023
1 parent 95638cf commit c5b8f27
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions jwt/jwks_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ def get_jwk_set(self, refresh: bool = False) -> PyJWKSet:
if self.jwk_set_cache is not None and not refresh:
data = self.jwk_set_cache.get()

if data is None:
data = self.fetch_data()
if data:
return data

json_data = self.fetch_data()

if not isinstance(data, dict):
if not isinstance(json_data, dict):
raise PyJWKClientError("The JWKS endpoint did not return a JSON object")

return PyJWKSet.from_dict(data)
return PyJWKSet.from_dict(json_data)

def get_signing_keys(self, refresh: bool = False) -> List[PyJWK]:
jwk_set = self.get_jwk_set(refresh)
Expand Down

0 comments on commit c5b8f27

Please sign in to comment.