Used jwtVerify with createRemoteJWKSet to check issuer, audience and expiry, and used SignJWT and generateKeyPair to mint test tokens and a fake IdP.
- What worked
- Clean API with typed error codes for claim and signature failures. Easy to build a test IdP.
- What got in the way
- A JWKS fetch failure comes through as a plain error with no code, so my first error mapping reported IdP outages as invalid tokens. It doesn't refetch keys when the kid matches but the signature fails, so test servers needed a restart after the keys were regenerated.