diff --git a/jwt/api_jwk.py b/jwt/api_jwk.py index b6b33790..370c9aab 100644 --- a/jwt/api_jwk.py +++ b/jwt/api_jwk.py @@ -114,10 +114,10 @@ def key_type(self) -> str | None: return self._jwk_data.get("kty", None) @property - def key_id(self) -> str | None: + def key_id(self) -> int | str | None: """The `kid` property from the JWK. - :rtype: str or None + :rtype: int, str, or None """ return self._jwk_data.get("kid", None) diff --git a/jwt/jwks_client.py b/jwt/jwks_client.py index 120eb256..3c8c4f71 100644 --- a/jwt/jwks_client.py +++ b/jwt/jwks_client.py @@ -121,7 +121,7 @@ def match_kid(signing_keys: List[PyJWK], kid: str) -> Optional[PyJWK]: signing_key = None for key in signing_keys: - if key.key_id == kid: + if str(key.key_id) == kid: signing_key = key break