feat(proxy): support ADC/OAuth2 auth when no API key is set#178
Open
Eyalm321 wants to merge 1 commit intodavideast:mainfrom
Open
feat(proxy): support ADC/OAuth2 auth when no API key is set#178Eyalm321 wants to merge 1 commit intodavideast:mainfrom
Eyalm321 wants to merge 1 commit intodavideast:mainfrom
Conversation
3ae9df0 to
63b7d7f
Compare
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.
63b7d7f to
b3d2501
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
gcloudService.getAccessToken()into the proxy handler so that whenSTITCH_API_KEYis not set, the proxy falls back to Application Default CredentialsSTITCH_USE_SYSTEM_GCLOUDworkflows, especially on Windows where system gcloud integration is neededaccessTokensupport in the SDK proxy moduleProblem
The proxy handler only passes
apiKeytoStitchProxy. TheSTITCH_USE_SYSTEM_GCLOUDenv 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 hardcodesX-Goog-Api-Keyheaders and has noaccessTokenfield.Changes
Source (
src/commands/proxy/)GcloudServicedep; when noSTITCH_API_KEYis set, callensureInstalled()thengetAccessToken()and pass the token toStitchProxyGcloudHandlerand pass it toProxyCommandHandlerTest plan
STITCH_USE_SYSTEM_GCLOUD=trueand noSTITCH_API_KEY— discovered 12 toolsSTITCH_ACCESS_TOKENenv var (direct token)gcloud auth print-access-token)npx tsc --noEmit— zero errors in changed files)