JWT Verification Error: invalid signature (Key Rotation / Wrong Key)

Identity provider rotated signing keys and verifier cached stale JWKS or used wrong `kid`.

Runs locally in browser Free · No login Independently Verified 2026-11-25 v4.1.0
Identifier: JWT Verification Error Platform: Security
Common Root Causes:
  • Identity provider rotated signing keys and verifier cached stale JWKS or used wrong `kid`.

Interactive Diagnostic Checklist

Verified Solutions:
  1. Fetch JWKS dynamically with cache refresh on unknown `kid` and pin allowed algorithms.
Safe Diagnostic Command:
Decode JWT header `kid` and compare with `/.well-known/jwks.json`
Warning: Verify configuration changes in staging or with dry-run flags (e.g. nginx -t) before reloading production services.

Technical Explanation

Identity provider rotated signing keys and verifier cached stale JWKS or used wrong `kid`. Recommended diagnostic: `Decode JWT header `kid` and compare with `/.well-known/jwks.json``. Remediation: Fetch JWKS dynamically with cache refresh on unknown `kid` and pin allowed algorithms.

Worked Examples

  • Run `Decode JWT header `kid` and compare with `/.well-known/jwks.json`` to verify root cause before applying the remediation.

Limitations & Assumptions

  • Always verify configuration changes in staging or with dry-run flags (e.g. `nginx -t`) before reloading production services.

Source References & Verification

Resource ID: err-jwt-invalid-signature-jwks-rotation · Independently verified: 2026-11-25

Related Resources