JWT in the body

Hi, I have to send a request and do not know how to create a pre-request script. The issue is that the payload should be signed in JWT RS256 (Sign with private key), but the token should be sent in the body, so…

If I have the body:

        "client": 31018881,
        "subMethod": null,
        "provider": "6f2dd96b-e48a-4c85-94f9-33dcec9c4acb",
        "Currency": "EUR"

I should send this payload: {"token": "token in RS256"}

Some help will be appreciated.


Hey @telecoms-candidate12 :wave:

I don’t think that there is a straightforward way of doing that (I’m probably wrong though), there going to be a few moving parts and code to get what you need I believe.

We do have a JWT Helper under the Auth tab but as you require this in the request body, I don’t think that’s going to work for you.

I’ve never done it like this so my responses are going to be based on a bit of research and learning as i’m going. :pray:

There is this older topic which is bringing an external lib to do some of the heavy lifting:

This is also something similar which was asked and answered by someone who works at Postman so I could ask him to help out here.

A lot of people are mentioned this util lib that could be brought into Postman via a CDN and stored at the global level. I can’t vouch for this though so it’s up to you if that’s something you want to use.

Thanks for your help, I will check that.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.