Additional context
I’m reauthorizing the app with the same account(revoking the token), as this will be a common scenario for my app, and was working before. Please provide advice on this.
If you’re running into an invalid token error, keep in mind that access tokens expire after one hour. Once expired, you will have to refresh a user’s access token. The purpose of the refresh token is to request a new access token. Although the refresh token expires after 15 years, it becomes invalid after it is used to request a new access token. You will receive a new refresh token pair and an access token once you use the old refresh token. You will have to update these old values with new ones.
Typically, these are the most common reasons for such an error:
If a new access token is generated, both the previous access token and refresh token will become invalid. So you will need to update each of these tokens each time you request a new access token.
Another situation that can arise is if multiple requests are sent using the same refresh token within a short amount of time, a race condition may prevent all requests from going through successfully. In this case, if you are not able to update the refresh token at your end (this generally happens when you make multiple requests in a short amount of time), a recommended workaround would be to reauthorize the app.
If a user uninstalls the app by revoking the authentication, the refresh token will become invalid. This may not be a scenario in your case.
I am having this same issue. The original access_token works for an hour after authentication but as soon as that token is expired and we request a new one like you are doing I get the same error message.