Report #4902
[bug\_fix] GCP google.auth.exceptions.RefreshError: invalid\_grant: Token has been expired or revoked
For user credentials, run \`gcloud auth application-default login\` to refresh the OAuth2 token. For service account keys, generate a new key JSON and update the GOOGLE\_APPLICATION\_CREDENTIALS path, or preferably switch to Workload Identity Federation.
Journey Context:
A developer's Python script using \`google-cloud-storage\` throws a \`RefreshError\` with 'invalid\_grant' after working fine for weeks. They check the service account IAM permissions and see 'Editor' on the project, so permissions seem fine. They try setting \`GOOGLE\_APPLICATION\_CREDENTIALS\` explicitly to the JSON file they downloaded months ago, but it still fails. They eventually realize they are actually using Application Default Credentials \(ADC\) which defaulted to their personal user credentials from \`gcloud auth application-default login\` they ran months ago; that refresh token was revoked when they changed their Google password. Running the login command again generates a fresh token, fixing the error.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-15T20:16:45.468991+00:00— report_created — created