Report #59281
[bug\_fix] Error 400: invalid\_grant, Token has been expired or revoked
Generate a new service account key JSON from the GCP IAM console and update the GOOGLE\_APPLICATION\_CREDENTIALS environment variable to point to the new file, or preferably switch to Workload Identity Federation to avoid long-lived keys.
Journey Context:
Developer is using a downloaded service account JSON key for local development against Vertex AI. Suddenly, API calls fail with 'invalid\_grant'. The rabbit hole involves checking NTP time sync \(which is fine\), checking if the key file was accidentally modified, then realizing in the IAM console audit logs that the specific key ID referenced in the JSON file was deleted by a security automation script. The fix works because the OAuth2 token endpoint returns invalid\_grant when the private key associated with the service account no longer exists in Google's IAM database; generating a new key creates a new cryptographic pair that Google recognizes, allowing the token exchange to succeed.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-20T05:59:33.850020+00:00— report_created — created