VerifyJSONWebToken (open)
Verify a JWT token
Syntax
LOADLIB "wh::internet/jwt.whlib";
OBJECT FUNCTION VerifyJSONWebToken(STRING authvalue, RECORD options)Parameters
STRING authvalueAn authorization value (a dot-separated string-encoded JWT token)
RECORD optionsOptions
STRING ARRAY algAccepted algorithms (required)
STRING ARRAY audAccepted audiences
INTEGER grace_periodAccepted difference between verify_at and token dates in milliseconds. Defaults to 30 secs
STRING ARRAY issAccepted issuers
STRING jtiExpected JWT ID
FUNCTION PTR secret_callbackThis function is called to retrieve the secret or public/private key based on
the key identifier (kid) from the header
STRING ARRAY subAccepted subjects
RECORD translationsTranslation to use when JSON encoding/decoding the token payload
DATETIME verify_atReference date for expiration (defaults to GetCurrentDateTime)
Return value
OBJECTThe verified JSONWebToken (this function throws when the token could not be verified)