google-analyticsgoogle-apigoogle-developers-consolegoogle-developer-toolsoauth2-playground

'Token has been expired or revoked' - Google OAuth2 Refresh token gets expired in a few days


I am using Google Analytics API to fetch analytics data. I tried to authenticate it using following steps:

But after a few days, the refresh token expires although it is mentioned that the refresh token's validity is life long.


Solution

  • If your app is in testing mode then user tokens will expire in 7 days. Please find this explanations here: https://support.google.com/cloud/answer/10311615#zippy=%2Ctesting enter image description here