Q1. How does OAuth refresh token work in the new OAuth Account? Is there any schedular that runs for token refresh and how is it tracking token expiry?
Firstly, there is no scheduler and tracking of token expiry. Adeptia doesn't unnecessarily hit the Account for the expiry token. When the token expires, it gets the 401 unauthorized response from the server, and after this, the OAuth Account fetches the new token automatically and uses the same until it expires.
Q2. How refresh token works on expiry. How to handle errors in OAuth account example, in case of token expired and OAuth account is not able to fetch new token?
The first WSC consumer that receives the 401 response code refreshes the token and all others then uses the updated access token.
Q4. What if OAuth is not able to fetch the token, what is the error alert.
The error message is "Authorization failed: Access token not valid and unable to refresh the access token."