Applies to
Any SDK or MCP server that reads Google Cloud Application Default Credentials (ADC):| SDK / Tool | Credential file |
|---|---|
| Anthropic Python SDK (Vertex) | ~/.config/gcloud/application_default_credentials.json |
google-cloud-aiplatform | ~/.config/gcloud/application_default_credentials.json |
Any google-auth based client | ~/.config/gcloud/application_default_credentials.json |
Create the stub
Create the directory if it doesn’t exist:mkdir -p ~/.config/gcloud
~/.config/gcloud/application_default_credentials.json
Rules
- Never overwrite existing files that don’t contain
onecli-managedvalues. The user likely has real gcloud credentials at this path. - All sentinel values use the string
onecli-managedso they’re easy to detect programmatically. typemust be"authorized_user"for the SDK to attempt the OAuth refresh flow.
How it works
The SDK reads the stub and sees dummy credentials. When it tries to exchange the refresh token atoauth2.googleapis.com/token, the OneCLI gateway intercepts the request and returns a real access token from the Vertex AI app connection you registered. The SDK then uses that token for requests to {region}-aiplatform.googleapis.com. The gateway also injects the x-goog-user-project header for quota and billing.