jwt_decode
Decode JSON Web Tokens and analyze claims: returns header, payload, signature, and expiry status. Optionally verify HS256/384/512 with a secret or RS256/384/512 with a PEM key.
Instructions
Decode a JSON Web Token (JWT) and analyse its claims. Always returns header, payload, signature info, and expiry status (active/expired/not_yet_valid) computed from exp/nbf/iat. When secret is provided, verifies HS256/HS384/HS512 via HMAC. When public_key is provided in PEM format, verifies RS256/RS384/RS512 via openssl_verify. ES* and EdDSA are decoded but not verified. The token is never logged.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Full JWT (three base64url segments joined with dots). "Bearer " prefix is stripped automatically. | |
| secret | No | Shared secret for HS256/384/512 verification. Optional. | |
| public_key | No | PEM-format RSA public key for RS256/384/512 verification. Optional. |