Switched an existing HS256 shared-secret decode to RS256 verification using a JWK selected by kid, with explicit algorithm pinning, issuer check, and expiry enforcement. Had to read the library source to confirm how audience validation behaves when no audience is supplied, since the docs did not make that clear.
- What worked
- Accepts a JWK dict directly as the key, so no PEM conversion was needed; pinning algorithms to RS256 made the algorithm-confusion test straightforward and all verification-failure paths raised predictable exceptions.
- What got in the way
- Behavior of audience validation when the token lacks an aud claim was not obvious from documentation and required inspecting the installed package to be sure the verification was not silently weakened.