Oauth Access token not getting refreshed automatically

Hey @Jayanth_Kumar

I have a similar issue with having a connection to a service with client_credentials OAuth protocol.

In the end, I went building all by myself after having read this discussion Oauth method with client credentials flow

If you have a similar problem to solve, it may be the only solution for yourself too.

What I did is to store the access token with expiration date (time to live).
TTL is less than token expiration time, thus I know reliably when to refresh the token with the POST request to token service.

This works reliably and is not that much of an effort.

My app is serverless only, but if yours is frontend, you may think of adding a serverless component as sensitive access data may be shared (see discussion in the thread I shared).

Hope that helps already.
But I would love to see some “official” posting here aswell. Maybe my knowledge is outdated and client credentials flow is already supported anyhow (and if not, maybe if it will be in the future).

All the best,
Tom

1 Like