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 GetJWTByKeyName() and its companion function GetJWT() is the first parameter. The GetJWTByKeyName() first parameter is a key name that matches a CustomerKey value of a MID (ClientID). Using this form of the function pulls the symmetric key belonging to that MID.

1stringRequiredA key name matching the CustomerKey value of the MID.
2stringRequiredName of a JWT standard hash algorithm from among HS256, HS384, or HS512.
3stringRequiredThe payload, typically a JSON object with name-value pairs. The payload isn't encrypted.

The GetJWTByKeyName() function only supports pulling a symmetric key from the MC M&J Public Key Management System based on the customer key value of the key.

Both GetJWTByKeyName() and its companion function GetJWT() convert the key string to a key byte array using UTF-8. It supports Base16, Base64, and ASCII character key strings. Keys strings outside of this range aren't guaranteed to be supported.

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 output is a JWT that looks like this example.