JWTVerify
Verifies a JWS signature and validates standard claims. Returns the decoded claims struct on success. Throws on any failure.
Method Signature
JWTVerify( token, [key], [algorithm], [options] )Arguments
token
string
Yes
Compact JWS token string to verify.
key
any
No
Verification key. Optional when defaultVerifyKey (or defaultSigningKey for HMAC) is configured.
null
algorithm
string
No
Expected algorithm. Resolved from key metadata or token header if omitted.
null
options
struct
No
claims (struct of expected claim values), clockSkew (seconds tolerance for exp/nbf).
{}
Returns
The verified claims as a struct.
Throws
bxjwt.JWTVerificationException— bad signature or claim mismatchbxjwt.JWTExpiredException— token is expiredbxjwt.JWTNotYetValidException— token not yet valid (nbf)bxjwt.JWTParseException— malformed token
Examples
Related
JWTValidate() — boolean version (no throw)
JWTCreate() — signed-token issuer
JWTDecode() — read header to choose key before verifying
Last updated
Was this helpful?
