I have an integration in place and I've already implemented the programmatical refresh of the access token before the expiry time. However, i would like to add a safeguard in case this primary refreshing method fails.
That would rely on knowing the specific format of the response in case of any request that is executed with an expired access token - could you provide that please? I cannot find any information on it from docs.
One more question - is there a way to manually expire the access token (for testing purposes)?
On making an API call with expired token, a status code 40X is returned with a proper response/error message that Access token is expired. Its not feasible to rely on specific format response. Instead you can make a check before every call if your access token in valid or not with the help of expires_in parameter value that is returned while auth process.
You can save expires_in value as like current timeStamp + expires_in into a DB record. And before making each call do a check if current timeStamp > Saved value into DB, then refresh the access token else you can continue with same token.
Hey, I am in need to know that which API will regenerate the access token for me if my previous one got expired. I am checking its expiry by expires_In but now i dont know which API to call to get a new access token. Can you please provide me with that endpoint and its details? Thanks
On making an API call with expired token, a status code 40X is returned with a proper response/error message that Access token is expired. Its not feasible to rely on specific format response. Instead you can make a check before every call if your access token in valid or not with the help of expires_in parameter value that is returned while auth process.
You can save expires_in value as like current timeStamp + expires_in into a DB record. And before making each call do a check if current timeStamp > Saved value into DB, then refresh the access token else you can continue with same token.
Hey, I am in need to know that which API will regenerate the access token for me if my previous one got expired. I am checking its expiry by expires_In but now i dont know which API to call to get a new access token. Can you please provide me with that endpoint and its details? Thanks
Yes either you can compare for expiry time or even more safe method will be to refresh token on when only few seconds left in expiry. This will never lead to any dead call with the access token expiry.
Thanks Lybek, I was actually hoping to just be able to set the expiration time to 0 to test that case of handling an expired access token. I ended up just noting another expired token and testing with that.