# How to generate a JWT Token synchronously in a Calculator step

**URL:** https://community.synatic.com/t/how-to-generate-a-jwt-token-synchronously-in-a-calculator-step/226
**Category:** Calculators
**Tags:** calculator, helper-functions
**Created:** [May 13, 2022, 4:06pm UTC](https://community.synatic.com/t/how-to-generate-a-jwt-token-synchronously-in-a-calculator-step/226 "2022-05-13T16:06:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![navessa](https://yyz2.discourse-cdn.com/flex032/user_avatar/community.synatic.com/navessa/32/58_2.png) [@navessa](https://community.synatic.com/u/navessa)
#### Post date: [May 13, 2022, 4:06pm UTC](https://community.synatic.com/t/how-to-generate-a-jwt-token-synchronously-in-a-calculator-step/226/1 "2022-05-13T16:06:17Z")

</div>

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.

![image](https://canada1.discourse-cdn.com/flex032/uploads/synatic/original/1X/a16364621904c60f994ef03662331f2cb6477673.png)

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

```auto
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 http://self-issued.info/docs/draft-ietf-oauth-json-web-token.html](https://github.com/auth0/node-jsonwebtoken)

[Decoding a JWT Token](https://help.synatic.com/en/articles/5352256-decoding-a-jwt-token)
