How do i create API ressource that needs a revalidated Bearer Token every 15 mins

Im trying to create an API ressource where i can revalidate the Bearer Token every 15 mins. But im stuck on how to do this in retool.

In an application i would just have a token handler but i can't see how that is possible in retool?

1 Like

Hello @Anders_Christiansen and welcome to the forums!

In your resource setup, you should be able to define a custom authorization workflow which includes a time based re-authorization trigger:

Since it seems like you are using a bearer token, you might need to build out the headers for the resource to include the returned token as a variable in the setup of the resource:

With the header on the resource looking something like:

2 Likes

Where do i find my "YourTokenData" part?
59267ce6bc8a85eb5318e66561c7e69f812bd5a8 copy

Hello @HMir -- welcome!

You should be able to see the token in your response data if you authorize through something like Postman:

image

In the example above, I would be using {{ http1.body.data.accessToken }} as that is the structure of the response object from the API. The http1.body is the base object that the Retool resource returns as the response, and then the data property has the accessToken property. In this example, you would also be able to access the status.code and status.id values.