SecurityJWKSJWK Setjwks_urikid

JSON Web Key Set

Definition

A JWKS (RFC 7517) is a JSON object with a keys array of public keys (JWKs), each identified by a kid, served at a well-known URL such as the jwks_uri in OpenID Connect discovery.

In practice

Verifiers fetch the set once, cache it and look up the key named by a token's kid header. Key rotation works by publishing the new key before signing with it and keeping the old key until every token it signed has expired, so caches catch up without downtime.

A verifier that caches the set but never refreshes it rejects every token after rotation. Refetch on an unknown kid, but rate-limit refetches so forged tokens with random kid values cannot hammer the issuer. Fetch only from the configured issuer, never from a URL inside the token.

Example

An API caches https://auth.example.com/.well-known/jwks.json for one hour; when a token arrives with kid: "2026-12" it does not know, it refetches at most once per minute.