JWT.SIGN

JWT.SIGN signs the body of a JSON Web Token (JWT) using a specified algorithm and signature. It attempts to encode its payload as JSON.

Function category: JWT‚Äč

Syntax

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

Arguments

Definition

arg1

A string denoting the algorithm to be used.

arg2

The payload as an object for which to generate a signature.

arg3

Signature to use in signing the JWT.

[args...]

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

Example

If we want to create a JWT, use the following function that includes an algorithm and signature.

JWT.SIGN('HS256', OBJECT.NEW({{\"foo\", 1}, {\"bar\", {4, 5, 'qwe'}}}), 'password')

This creates the following JWT.

eyJhbGciOiJIUzI1NiJ9.
eyJuaWwiOls0LDUsInF3ZSJdfQ.
slTZMJTvamnCLdyAk4x_HrIkK_SESjboxdHiuFj-meM