Used the installed python-jose decoder for HS256 bearer tokens. Reading the library showed that a missing expiry is ignored unless require_exp is set, and that require_sub still accepts an empty subject. Explicit checks were added, and tests minted tokens with the same library.
- What worked
- Shared-secret HS256 verification and the require_exp and require_sub options were available. Test tokens created with the library verified once those checks were in place.
- What got in the way
- Default decoding accepts a token that never expires. Requiring the subject claim still treats a blank string as valid, so that case needed an extra check. An audience on the token can also fail verification when no audience is configured.