Free — no signup required

What is a JWKS?

2 min read

JSON Web Key Set

JWKS stands for JSON Web Key Set. It is a standardized, read-only HTTP endpoint — typically hosted at /.well-known/jwks.json — published by an Identity Provider (IdP) such as Auth0, Okta, Google, or your own authentication service. The endpoint returns a JSON object containing the set of public keys currently active for signing tokens.

Think of it as a public bulletin board where the auth server posts its current public keys. Any service that needs to verify a JWT can read from this board at any time.

Example JWKS response:

{
  "keys": [
    {
      "kid": "key-id-123",
      "kty": "RSA",
      "alg": "RS256",
      "use": "sig",
      "n": "sT7vhDmMHBDsnmvFBqNMGqhGpMgFMpKdXuam9O3...",
      "e": "AQAB"
    },
    {
      "kid": "key-id-456",
      "kty": "EC",
      "alg": "ES256",
      "use": "sig",
      "crv": "P-256",
      "x": "f83OJ3D2xF1Bg8vub9tLe1gHMzV76e8Tus9uPHvRVEU",
      "y": "x_FEzRu9m36HLN_tue659LNpXW6pCyStikYjKIWI5a0"
    }
  ]
}

Decoding the Fields

Each key object in the keys array is a JWK (JSON Web Key). The fields follow the RFC 7517 standard:

Field Name Meaning
kid Key ID Unique identifier for this key. Used to look up the right key.
kty Key Type Cryptographic family: RSA or EC (Elliptic Curve).
alg Algorithm Specific algorithm: RS256, ES256, etc.
use Public Key Use sig (signature) or enc (encryption).
n Modulus RSA-specific: the public key modulus (base64url-encoded).
e Exponent RSA-specific: the public exponent (almost always AQAB = 65537).
crv Curve EC-specific: the elliptic curve name (P-256, P-384).
x, y Coordinates EC-specific: the public key point on the curve.

The kid (Key ID): The Critical Link

The most important field is kid. When a JWT is issued, its header embeds the kid of the key used to sign it:

{
  "alg": "RS256",
  "kid": "key-id-123",
  "typ": "JWT"
}

When a verifier receives this token, it:
1. Decodes the JWT header (no secret needed — headers are base64url-encoded, not encrypted).
2. Reads the kid value (key-id-123).
3. Fetches the JWKS endpoint and finds the key with matching kid.
4. Uses that public key to verify the token's signature.

Without kid, the verifier would have to try every key in the set until one works — inefficient and error-prone. With kid, the lookup is O(1).

This is one of 18 chapters

Every chapter is free — Kubernetes, Terraform, SRE, distributed systems, and more — with fast daily review built in.

Sign up free