How to deal with expiring authentication tokens

I am trying to build a custom gpt with action that uses an API. The API is usually authenticated via oauth through inputing the client_id and client_secret to retrieve an access token before making any other calls.

I was unable to get the action working using oauth because the access token needed to be generated first even if I had the client_id and client_secret. As such, I switched to using API key as the authentication method and used an access token I retrieved using curl as the key. This works great now!

However, these tokens expire every 30 minutes which would not be suitable for my project. I see two solutions:

  • either make the action work using oauth with client_id and client_secret, in which case I would love some guidance
  • have a way to continuously renew the access token

Any advice would be appreciated! Thank you!