Skip to content

feat(proxy): support ADC/OAuth2 auth when no API key is set#178

Open
Eyalm321 wants to merge 1 commit intodavideast:mainfrom
Eyalm321:feat/adc-access-token-auth
Open

feat(proxy): support ADC/OAuth2 auth when no API key is set#178
Eyalm321 wants to merge 1 commit intodavideast:mainfrom
Eyalm321:feat/adc-access-token-auth

Conversation

@Eyalm321
Copy link
Copy Markdown

@Eyalm321 Eyalm321 commented Apr 14, 2026

Summary

Problem

The proxy handler only passes apiKey to StitchProxy. The STITCH_USE_SYSTEM_GCLOUD env var is used in the auth service but never wired into the proxy handler. Additionally, the SDK's proxy module itself only supports API key auth — it hardcodes X-Goog-Api-Key headers and has no accessToken field.

Changes

Source (src/commands/proxy/)

  • handler.ts: Accept optional GcloudService dep; when no STITCH_API_KEY is set, call ensureInstalled() then getAccessToken() and pass the token to StitchProxy
  • command.ts: Instantiate GcloudHandler and pass it to ProxyCommandHandler

Test plan

  • Verified proxy connects to Stitch via ADC with STITCH_USE_SYSTEM_GCLOUD=true and no STITCH_API_KEY — discovered 12 tools
  • Verified proxy works with STITCH_ACCESS_TOKEN env var (direct token)
  • Verified proxy works with OAuth user token (gcloud auth print-access-token)
  • Type-checks clean (npx tsc --noEmit — zero errors in changed files)
  • Existing tests still pass (485 pass, 6 skip, 0 fail)
  • Test with API key auth to confirm no regression — discovered 12 tools

@Eyalm321 Eyalm321 force-pushed the feat/adc-access-token-auth branch 3 times, most recently from 3ae9df0 to 63b7d7f Compare April 14, 2026 20:29
Wire gcloudService.getAccessToken() into the proxy handler so that when
STITCH_API_KEY is not set, the proxy falls back to Application Default
Credentials. This enables STITCH_USE_SYSTEM_GCLOUD workflows, especially
on Windows where system gcloud integration is needed.

Depends on google-labs-code/stitch-sdk#314 for accessToken support in
the SDK proxy module.
@Eyalm321 Eyalm321 force-pushed the feat/adc-access-token-auth branch from 63b7d7f to b3d2501 Compare April 14, 2026 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant