GetJWT()

This function allows users to create JSON web tokens (JWTs). It uses a key to create a hash of the JWT payload. The hash is included in the JWT content to allow validation. The JWT payload isn’t encrypted.

The difference between GetJWT() and its companion function GetJWTByKeyName() is the first parameter. The GetJWT() first parameter is a key string that the caller supplies directly through their preferred method. For example, the key string is encrypted and stored in a data extension.

The GetJWT() function has three parameters:

  • keyName (string): Required. A key name matching the CustomerKey value of the MID.
  • algorithm (string): Required. Name of a JWT standard hash algorithm from among HS256, HS384, or HS512.
  • jsonPayload (string): Required. The payload, typically a JSON object with name-value pairs. The payload isn't encrypted.

The function returns a JWT string. If syntax for the function is invalid, the parser throws an InvalidFunctionException. If the function call is invalid, for example, as having an invalid parameter value, the parser throws a FunctionExecutionException, including details in an inner exception.

The function outputs a JWT.