JWT.VERIFY

JWT.VERIFY will verify the signature of a JWT and extract the payload, attempting to encode it as JSON and wrapping it in a data envelope.

Function category: JWT‚Äč

Syntax

JWT.VERIFY(arg1, arg2, arg3, [args...])

Arguments

Definition

arg1

String denoting the algorithm to be used.

arg2

String of the input data to verify.

arg3

String of the expected signature.

[args...]

An additional set of arguments for use with certain subsets of algorithms.

Example

Let's say we received the following signed JWT that we want to verify.

eyJhbGciOiJIUzI1NiJ9.
eyJuaWwiOls0LDUsInF3ZSJdfQ.
slTZMJTvamnCLdyAk4x_HrIkK_SESjboxdHiuFj-meM

We use JWT.VERIFY to verify the sender and extract the payload. By calling JWT.VERIFY, we can ensure that it was signed with the password provided using the following function.

JWT.VERIFY('HS256',
'eyJhbGciOiJIUzI1NiJ9.eyJuaWwiOls0LDUsInF3ZSJdfQ.slTZMJTvamnCLdyAk4x_HrIkK_SESjboxdHiuFj-meM',
'password')

This returns the following.

{ payload: { "foo" 1 "bar" [4 5 "qwe"] } }

Notes

If JWT.VERIFY encounters an error, it will return a response with the following structure

{ error: error_description }

In which error_description will be a string describing the nature of the error encountered.