API call using HTTP Request activity and JWT that uses current Epoch time

Hey everyone, any help is appreciated.

I can successfully make a POST API call using Postman.com, i need to translate that into the HTTP request in UiPath studio.

One issue I’m struggling to get my head around is that I need to authenticate using a JSON web token, which is easy enough online, but part of the payload within that JWT is ‘iat’ (iat = issued at, it is the current time in UTC in epoch seconds. The token expires within 30 seconds of the current time).

Example:

{
  "iss": "my_serice_id",
  "iat": 1719504660
}

So I need to generate a new JWT and use it within 30 seconds of its generation each time i wish to use the API service.

My question is, how do i generate the JWT locally in UiPath studio before implementng it into the HTTP request?

Hope I’ve explained myself, any questions don’t hesitate

Ta

@Trouble666

May I know how are you generating jwt in postman?

is the issue getting epoch time?

cheers

Hi,

Im generating the JWT as part of the ‘Authorisation’ tab in Postman:

I can generate epoch time in UiPath studio, the problem is getting that into a JWT within studio. Unless the HTTP Request activity wraps up headers as a JWT for me?

@Trouble666

Got you…I believe you need to go with .net code

cheers

Thanks for that.

I have a further Q, can this .net framework/code be ran natively in UiPath studio or do i need Visual Studio installed?

Thanks

You don’t need Visual Studio.

Thanks for the reply.

So if I use an invoke code activity I can copy the vb/c# code into it and it will run within UiPath? do i need any additional framework or libraries?