Google OAuth tokens expire every 7 days if app stays in 'Testing' mode by default
A developer's automated publishing pipeline repeatedly failed with an 'invalid_grant' token expiry error, initially mistaken for a previously fixed bug. The root cause was Google Cloud's OAuth consent screen defaulting to 'Testing' publishing status, which enforces a hard 7-day refresh token expiry regardless of how frequently the token is used. This setting, found under the Google Auth Platform's Audience tab, is not flagged during initial setup, making it easy to overlook. Unlike 'In production' status, which grants long-lived tokens, Testing mode is designed for short-lived experiments and restricts authentication to pre-approved test users. Switching the publishing status to 'In production' resolved the issue; for apps using only low-risk scopes like Blogger or Search Console, this change does not trigger Google's full verification review process.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in