Bearer Token API integration

I’m working with an API that requires a Bearer token for authentication. The token expires every 20 minutes, so I need to:
1. Request a new token from the authentication endpoint
2. Use that token in the Authorization header for subsequent API calls
3. Refresh the token automatically before it expires

From what I can tell, Retool doesn’t seem to support this natively as part of the standard REST API resource setup.
• Is there a built-in way in Retool to handle token generation and refresh for short-lived Bearer tokens?
• If not, what is the recommended approach for implementing this workflow in Retool?
• Should I use a JS query to request and store the token, then inject it into my API queries, or is there a better method?

Hi there @R_S_I_F, and good to see you again,

I think it depends on how your endpoint requires the refresh call to be made, however there are several options that retool offers.

Here's one that I think may be actually a good first direction for you, based on what you described:

Hope this helps!

Miguel

i checked it, it doesn't work

Would you mind sharing a bit more of what you tried, a screenshot of your custom auth would be super helpful to trouble shoot.

Also if possible any documentation related to the API you're working with.

Thanks!

1 Like

Hi @R_S_I_F,

Just wanted to check in if you are still having this issue. Also wanted to echo Miguel to see if you could share more details on what you tried so we can better assist!