OAuth2: How to check when only the refresh token is invalid #1515
Labels
priority: p3
Desirable enhancement or fix. May not be included in next release.
type: question
Request for information or clarification. Not an issue.
Hey folks,
How can we check when the refresh token needs to get revalidated?
If these are the conditions that will cause it to expire:
What code can we write as a check to see if the refresh token needs to be updated?
We tried to run getTokenInfo() but unless we want to update the accessToken right before an expired access token will just error, so the below throws if either the refresh_token or the access_token are invalid:
We can simply run
oAuth2Client.getAccessToken()
every single time beforegetTokenInfo
but that seems counterproductive to the efforts of the google team to make the access token revalidate automatically. We could also wrap every api request in a try/catch but that seems overly engineered.The text was updated successfully, but these errors were encountered: