Report #79401
[bug\_fix] Request had invalid authentication credentials. Expected OAuth 2 access token \(GCP Application Default Credentials\)
Run \`gcloud auth application-default login\` to refresh the ADC token. The root cause is that user credentials obtained via \`gcloud auth application-default login\` are OAuth 2.0 refresh tokens stored locally \(typically in \`~/.config/gcloud/application\_default\_credentials.json\`\) that expire after a period of inactivity or when revoked.
Journey Context:
Developer is running a local Python script or Terraform that uses the Google Cloud client libraries. The code relies on Application Default Credentials \(ADC\) to authenticate. Suddenly, the script fails with a 401 'invalid authentication credentials' error. The developer checks \`echo $GOOGLE\_APPLICATION\_CREDENTIALS\` and it's unset, so the library should be using the credentials from \`gcloud auth application-default login\`. They check \`~/.config/gcloud/application\_default\_credentials.json\` and the file exists but contains a refresh token that has expired. The developer realizes that unlike service account keys, user credentials from \`gcloud auth application-default login\` expire and need periodic refreshing. After running \`gcloud auth application-default login\` and completing the OAuth flow in the browser, the script works again.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T15:52:28.340172+00:00— report_created — created