Categories
Development

Postman JWT token generator

Use script below to generate and set JWT token with HS256 signature and store it in “jwt” environment variable. To use it edit SECRET_KEY and set headers as you need. Then paste the script into pre-request script in postman HTTP request definition. Use the environment variable {{jwt}} in your authentication of type Bearer to use it.

You can check the result token in https://token.dev/. And you can read all about JWT and their signing at https://auth0.com/blog/rs256-vs-hs256-whats-the-difference/ .

Code taken/was derived from  https://hirosht.medium.com/customized-jwt-encoded-with-hmac-sha256-hs256-267574bd7639