Skip to content

fix: deployed gdrive OAuth uses real Google creds, not emulator mocks - #155

Merged
jodeleeuw merged 1 commit into
testfrom
provider-migration
Jul 24, 2026
Merged

fix: deployed gdrive OAuth uses real Google creds, not emulator mocks#155
jodeleeuw merged 1 commit into
testfrom
provider-migration

Conversation

@jodeleeuw

Copy link
Copy Markdown
Member

Problem

Connecting Google Drive on datapipe-test.web.app sent users to a localhost/127.0.0.1 authorize URL instead of Google's consent screen.

Root cause: Firebase loads functions/.env.datapipe-test on both firebase deploy and the emulator. That file held the emulator mock values (127.0.0.1 token/authorize servers, test-client-id, localhost:3000 redirect), so the deployed functions handed those to the browser.

Fix

Split emulator vs. deployed config along Firebase's emulator-only .env.local seam (.env.local is 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 .gitignore so 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 — injects GDRIVE_CLIENT_SECRET from the new TEST_GDRIVE_CLIENT_SECRET GitHub secret.

Prereqs already done

  • Drive API enabled on datapipe-test
  • OAuth consent screen + Web client created (redirect https://datapipe-test.web.app/oauth2/connect, scope drive.file)
  • TEST_GDRIVE_CLIENT_SECRET GitHub secret set

Verification

oauth-connect-emulator, gdrive-emulator, resolve-token-gdrive suites pass (24/24) — .env.local overrides shadow the real values under the emulator, so CI stays green.

Merging this to test triggers firebase-deploy-test.yml, which deploys the functions with real Drive creds.

Note: .env.datapipe-test still carries a dummy TOKEN_ENCRYPTION_KEY that overrides the real FIRESTORE_KEY_TEST secret on deploy (same pre-existing leak pattern). Left as-is here to avoid orphaning already-encrypted test tokens — worth a separate follow-up.

🤖 Generated with Claude Code

…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>
@jodeleeuw
jodeleeuw merged commit cfaa303 into test Jul 24, 2026
1 check passed
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