Authentication
Candela includes native authentication — no gcloud or aws CLI required. The candela auth commands handle OAuth2 flows, credential storage, and token refresh for all supported cloud providers.
Quick Start
Section titled “Quick Start”-
Authenticate with your cloud provider
Terminal window candela auth loginOpens a browser for Google OAuth2 consent. On success, writes Application Default Credentials (ADC) to the standard location (e.g.,
~/.config/gcloud/application_default_credentials.jsonon macOS/Linux).Terminal window candela auth login --provider awsValidates your existing AWS credentials (from
~/.aws/credentials, SSO, or environment variables) and confirms Bedrock model access. -
Verify your credentials
Terminal window candela auth statusShows the active provider, credential source, token expiry, and project/region configuration.
-
Start using Candela
Terminal window candela startThe proxy automatically uses your authenticated credentials to forward requests to cloud LLM APIs.
Auth Commands
Section titled “Auth Commands”| Command | Description |
|---|---|
candela auth login | Start OAuth2 flow for GCP (default) |
candela auth login --provider aws | Validate AWS credentials for Bedrock |
candela auth status | Show active credentials, provider, and expiry |
candela auth token | Print a valid access token (refreshes if expired) |
How It Works
Section titled “How It Works”GCP (Google Cloud / Vertex AI)
Section titled “GCP (Google Cloud / Vertex AI)”Candela performs a standard OAuth2 authorization code flow:
- Opens your browser to Google’s consent screen
- Receives the authorization code via a local callback server
- Exchanges the code for access and refresh tokens
- Writes the credentials as an Application Default Credentials (ADC) JSON file
The ADC file is stored at ~/.config/gcloud/application_default_credentials.json — the same location used by Google Cloud client libraries. This means your credentials work seamlessly with:
- Candela proxy routes (
/proxy/anthropic,/proxy/google, etc.) - Any Google Cloud SDK or client library
- The Candela Desktop app (reads and refreshes tokens directly)
AWS (Bedrock)
Section titled “AWS (Bedrock)”For AWS Bedrock, Candela reads your existing AWS credential chain:
- Environment variables (
AWS_ACCESS_KEY_ID,AWS_SECRET_ACCESS_KEY) - Shared credentials file (
~/.aws/credentials) - SSO session credentials (
aws configure sso) - IAM instance profile (for EC2/ECS/Lambda)
candela auth login --provider aws validates the active credentials and checks that the configured region has Bedrock model access enabled.
Token Lifecycle
Section titled “Token Lifecycle”| Event | Behavior |
|---|---|
| Token valid | Proxy uses cached token — zero overhead |
| Token expired (< 5 min remaining) | Automatic background refresh using the stored refresh token |
| Refresh token revoked | candela auth status shows “expired” — run candela auth login again |
| No credentials found | Proxy returns 401 with a clear error message directing you to candela auth login |
The Candela Desktop app performs the same token refresh cycle directly against oauth2.googleapis.com/token, showing the real token expiry time in the dashboard (not a hardcoded estimate).
Legacy: Using gcloud CLI
Section titled “Legacy: Using gcloud CLI”If you already have gcloud installed, its credentials also work:
gcloud auth application-default loginThis writes the same ADC file that Candela reads. However, candela auth login is preferred because:
- No
gcloudCLI installation required - Faster startup (no subprocess overhead)
- Works identically on all platforms
- The Desktop app can refresh tokens without shelling out
Team Mode: IAP Authentication (Dual-Token)
Section titled “Team Mode: IAP Authentication (Dual-Token)”When your team runs a Candela server behind Identity-Aware Proxy (IAP), candela uses a dual-token authentication flow. IAP requires its own OIDC token, but it also replaces the Authorization header with its own JWT — so candela must send the developer’s real identity through a separate header.
# ~/.config/candela/config.yaml — Team Mode with IAPport: 8181lm_studio_port: 1234runtime_backend: ollama
remote: https://candela-xxx.a.run.appaudience: "12345678.apps.googleusercontent.com"iap_service_account: candela-server@project.iam.gserviceaccount.comHow it works:
- Developer runs
candela auth login --provider gcpto obtain user ADC - On each cloud-model request,
candelasends two tokens:Proxy-Authorization: Bearer <oidc-token>— impersonated SA OIDC token for IAP authenticationX-Candela-Auth: Bearer <access-token>— the developer’s own ADC OAuth2 access token
- IAP validates the
Proxy-Authorizationheader and lets the request through, replacingAuthorizationwith its own JWT - The Candela server reads
X-Candela-Authfirst to identify the developer (calls Google’s userinfo endpoint) - If
X-Candela-Authis absent, it falls back to theAuthorizationheader strategies
Troubleshooting
Section titled “Troubleshooting”| Symptom | Cause | Fix |
|---|---|---|
401 Unauthorized on proxy requests | No valid credentials | Run candela auth login |
candela auth status shows “expired” | Refresh token revoked or consent withdrawn | Run candela auth login again |
403 Forbidden on Anthropic routes | Claude models not enabled in Vertex AI | Enable in Model Garden |
AWS InvalidSignatureException | Clock skew or wrong region | Verify region in config matches Bedrock availability |
| Token refresh loop | Corrupted ADC file | Delete ~/.config/gcloud/application_default_credentials.json and re-run candela auth login |