I'm working on integrating a third party API in my spring boot application.
How the third party API authentication works:
- After initial authorisation, I'm provided with refresh token and access token that expires after a given time
- After the access token expires I use the refresh token to get a new access token AND a new refresh token
With the current access token I can make calls to the API.
Is there a way to seamlessly handle such case using RestTemplate?
I've tried handling this case manually, so if I got 401 back from the API I sent a refresh token request, rewrote the keys I got back and retried the request, not really sure how to handle storing the api keys in case I need to restart the server.