feat(auth): separate browser API origin from token identity
What & why
Prepare separate paradev browser deployments while retaining api.superset.sh as the API token identity. Optional BROWSER_API_URL selects auth and integration OAuth callbacks, with existing behavior when unset or empty. Job and webhook destinations remain unchanged.
Pin MCP resource discovery to the canonical audience, accept safe API-domain continuations, and preserve existing connector grants across the two callback domains. Include deployment env plumbing; no production values, domains, or redirects are changed.
How I tested it
- 154 focused tests passed, including real auth metadata, Google authorization/exchange callback agreement, cross-domain connector refresh, and redirect validation.
- Repository-wide lint passed; all 42 repository-wide typecheck tasks passed.
- Full local run with continuation: 27/30 tasks passed; unchanged CLI hyperlink, shared recurrence-timezone, and host-service process suites failed. CLI formatting passes directly. GitHub CI Test passed on this commit.
- Independent implementation review completed with no remaining blockers.
- Isolated preview API, web, marketing, docs and Neon database deployments succeeded. Preview auth/MCP discovery, get-session, credentialed CORS, GitHub sign-in start callback, and browser sign-in rendering passed; captured console empty.
- Isolated HTTPS browser fixture using the installed PostHog SDK, production cookie settings and the repository identity guard passed root-to-app anonymous ID continuity, identify payload carrying the original anonymous ID, identified-ID continuity on return to marketing, and different-root isolation. Synthetic identity and local ingestion sink only.
- Real Chrome Google sign-in and PostHog person linking verified on the owned-domain preview. Marketing pageview at 2026-11-12 22:36:32 UTC used anonymous ID
01a1d1e7-cfa2-7a0c-b489-0466aa4355bf;$identifyat 22:37:39 UTC carried that exact$anon_distinct_idinto account ID1cb76e90-6e41-46c9-b587-50a690bb59d7. Marketing, app pageview, identify and post-login web-vitals resolve to person8f154561-9f1c-5956-98da-a8a0cf64d31c, confirmed identified in Preview project 264827. - The original vercel.app test exposed invalid
Domain=vercel.appauth cookies. Added opt-indomain-previewworkflow support and exact Google callback registration. State cookie is now scoped topr-9687.paradev.com; production callback URLs remain present. Aside blocked analytics with ERR_BLOCKED_BY_CLIENT; Chrome delivered the validation events. - Live desktop handoff, other integrations and production cutover remain unverified. This PR has not moved public traffic.
Checklist
- PR title follows conventional commits
-
bun run lintandbun run typecheckpass - Preview deployment smoke checks (default/fallback configuration)
- Real Google OAuth/browser identity-linking acceptance check in Chrome
Summary by CodeRabbit
-
New Features
- Browser-facing authentication and OAuth URLs can use a separately configured API origin, falling back to the existing API URL when unset.
- Sign-up redirects and connector callbacks support approved alternate domains.
- Labeled pull-request previews can use dedicated domains and shared authentication cookies.
-
Bug Fixes
- OAuth metadata and callback handling now support setups where browser and API origins differ.
-
Documentation
- Added guidance for browser OAuth origins, preview domains, and callback registrations.
Existing production effects and merge status
No production browser-origin value is added or changed by this PR; the GitHub production environment has no BROWSER_API_URL secret entry. This is preparation, not a domain cutover, but it is not literally zero-effect: MCP discovery resources become canonical /mcp, connector metadata accepts own-domain callback twins, and signup honors validated continuations.
Commit 46c3359b54 restores deploy-production.yml exactly to the base, avoiding workflow-path-triggered relay/realtime/agent-worker rollouts from this PR. Existing normal production deployment jobs still run after a merge. Latest GitHub CI and preview deployments passed on this revised head. The user subsequently authorized a preparatory merge after real browser/computer validation. Normal GitHub review requirements still apply; no admin bypass is requested.
Separate new-project preview validation is in #9691; the manual staging workflow for review is in #9692. Neither performs a public cutover.
Latest real regression validation
Updated to b080878f47 by merging main 8fd579d93a; resolved connector refresh conflicts while preserving main's concurrency reconciliation and twin-aware client cleanup. 63 focused tests and API/tRPC typechecks passed. Full GitHub CI and all previews passed on this exact head.
- Cua Driver controlled real Chrome: integrations, account, billing and home navigation rendered; hard reload preserved authentication. Billing was viewed only.
- Browser Use controlled Aside: real Google sign-in on the separate PR9691 projects succeeded with the existing preview identity; account reload preserved the session.
- Real desktop Google OAuth completed through API -> Google -> web success -> a localhost test receiver. The new desktop session authenticated as the expected preview user, and issued JWT passed signature, issuer, audience and subject checks against the preview canonical issuer/JWKS. The test desktop session was signed out afterward; the browser session remained valid. No installed desktop session was replaced, and no tokens were logged or persisted.
- PostHog Preview project264827 received the new Chrome integrations/account/billing pageviews (23:44–23:47 UTC), all on the original marketing person
8f154561-9f1c-5956-98da-a8a0cf64d31c. - Existing production app.superset.sh opened with authenticated navigation; no cutover or public routing change.
Notion/Teams live vendor authorization and production staging remain unverified. They are not enabled or migrated by this preparation.