fix: deployed gdrive OAuth uses real Google creds, not emulator mocks - #155
Merged
Conversation
…ocks The datapipe-test site sent users to a localhost authorize URL when connecting Google Drive. Firebase loads functions/.env.datapipe-test on both `firebase deploy` and the emulator, and that file held the emulator mock values (127.0.0.1 token/authorize servers, test-client-id, localhost redirect), so the deployed functions handed those to the browser. Split the two concerns along Firebase's emulator-only .env.local seam: - functions/.env.local (new, committed, never deployed) holds the mock values for local dev + the CI test suite. Un-ignored in .gitignore so a fresh checkout works with no setup; contents are non-secret test dummies. - functions/.env.datapipe-test now holds the real deployed config: the Google client id and https redirect uri. Authorize/token/api-base URLs are unset so the real Google defaults apply. - firebase-deploy-test.yml injects GDRIVE_CLIENT_SECRET from the TEST_GDRIVE_CLIENT_SECRET GitHub secret. Verified: oauth-connect / gdrive / resolve-token emulator suites stay green (.env.local overrides shadow the real values under the emulator). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Connecting Google Drive on datapipe-test.web.app sent users to a
localhost/127.0.0.1authorize URL instead of Google's consent screen.Root cause: Firebase loads
functions/.env.datapipe-teston bothfirebase deployand the emulator. That file held the emulator mock values (127.0.0.1 token/authorize servers,test-client-id,localhost:3000redirect), so the deployed functions handed those to the browser.Fix
Split emulator vs. deployed config along Firebase's emulator-only
.env.localseam (.env.localis loaded only by the emulator, never deployed, and takes precedence):functions/.env.local(new, committed, never deployed) — mock values for local dev + CI. Un-ignored in.gitignoreso a fresh checkout works with no setup; all values are non-secret test dummies.functions/.env.datapipe-test— now the real deployed config: Google client id +https://datapipe-test.web.app/oauth2/connect. Authorize/token/api-base URLs left unset so real Google defaults apply.firebase-deploy-test.yml— injectsGDRIVE_CLIENT_SECRETfrom the newTEST_GDRIVE_CLIENT_SECRETGitHub secret.Prereqs already done
datapipe-testhttps://datapipe-test.web.app/oauth2/connect, scopedrive.file)TEST_GDRIVE_CLIENT_SECRETGitHub secret setVerification
oauth-connect-emulator,gdrive-emulator,resolve-token-gdrivesuites pass (24/24) —.env.localoverrides shadow the real values under the emulator, so CI stays green.Merging this to
testtriggersfirebase-deploy-test.yml, which deploys the functions with real Drive creds.🤖 Generated with Claude Code