How to generate a JWT Token synchronously in a Calculator step

Illustrated in the image below is a Calculator step with the code that is used to generate a JWT Token. The value for the “payload” field can be any payload.


You can copy and paste the below code in your Calculator step:

let inputRecord=input.record;
let payload = {

let privateKey = fs.readFileSync('private.key')
inputRecord.jwt = utils.jwtSign(payload,privateKey, {"algorithm": "RS256"});
inputRecord.payload = payload;
return inputRecord;

The below link has additional information on the JSON Web Token:

GitHub - auth0/node-jsonwebtoken: JsonWebToken implementation for node.js

Decoding a JWT Token