Report #12509
[bug\_fix] unable to refresh access token: invalid\_grant
Re-authenticate the local environment by running \`gcloud auth application-default login\` to generate a new OAuth2 refresh token stored in \`~/.config/gcloud/application\_default\_credentials.json\`. Alternatively, for non-interactive environments, set the \`GOOGLE\_APPLICATION\_CREDENTIALS\` environment variable to point to a valid Service Account JSON key file, ensuring the service account is not disabled and the key is not deleted.
Journey Context:
A developer is running a Python script using \`google-cloud-storage\` on their laptop. The script uses Application Default Credentials \(ADC\). Three weeks ago, they ran \`gcloud auth application-default login\` to set up ADC. This morning, the script crashes with \`google.auth.exceptions.RefreshError: \('invalid\_grant: Token has been expired or revoked.', ...\)\`. The developer checks the GCP IAM console and sees that the service account they thought they were using actually isn't being used at all; the ADC is using their personal user credentials via the gcloud-generated refresh token. They check their Google Account security settings and see they revoked the 'Google Cloud SDK' app permission yesterday as a security cleanup. This invalidated the refresh token. Realizing ADC on local dev relies on this OAuth token, they re-run \`gcloud auth application-default login\` to generate a new valid refresh token, and the script works.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-16T16:13:35.345416+00:00— report_created — created