[BUG] Vertexai - Claude should use updated google credentials files when they change to support reauthentication
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [x] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 0.2.64 (Claude Code)
- Operating System: macos 15.3.2
- Terminal: iTerm2
Bug Description
When running claude in an enterprise environment against claude hosted on vertexai one way to authenticate is to first run gcloud auth login --update-adc to get an auth token for the user, and then run claude with GOOGLE_APPLICATION_CREDENTIALS pointed to the application default credentials eg GOOGLE_APPLICATION_CREDENTIALS="$(echo ~)/.config/gcloud/application_default_credentials.json" claude
This works well, until the credentials expire as a result of Session Length Restrictions. At that point claude logs API Error: {"error":"invalid_grant","error_description":"reauth related error and fails
Steps to Reproduce
gcloud auth login --update-adc- Start claude with
GOOGLE_APPLICATION_CREDENTIALS="$(echo ~)/.config/gcloud/application_default_credentials.json" claude - Verify claude works
- In a separate terminal run
gcloud auth application-default revoke. This isnt exactly the same as a credential expiry, the error isAPI Error: 401 {"error":{"code":401,"message":"Request had invalid authenticationbut it simulates the problem well enough. Alternatively you would need to configure a Session Length Restrictions for your GCP environment, wait for this session length restriction to expire and then continue - Go back to claude and test. Claude will fail
- Run
gcloud auth login --update-adcto log back in - Go back to claude and test. Claude will fail
Expected Behavior
After running gcloud auth login --update-adc in step 6 claude should load the new application default credentials and use those to authenticate to vertexai, and then step 7 should succeed
Actual Behavior
Step 7 fails, claude does not use the updated credentials file.
Additional Context
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗