fix(web): redirect Google auth through callback#1723
Draft
Conversation
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
This PR changes Google authorization in Compass from a popup-based flow to a full-page redirect flow. Both Google sign-in/sign-up and “Connect Google Calendar” now leave Compass through Google and return through a dedicated callback page at
/auth/google/callback.The PR also fixes a related local-data issue: seeded demo events are now marked as demo-only in the browser, so they do not get uploaded into a user’s real account when the user later signs in or connects Google.
Why This Changed
The previous Google flow relied on popup behavior and a looser redirect setup. That made the flow harder to reason about and left Compass depending on popup-specific cancellation/error handling.
This branch makes the Google flow explicit:
What Changed
Google authorization now uses a redirect callback
Google authorization now returns through
/auth/google/callback.Before sending the user to Google, Compass stores a short-lived authorization intent in browser session storage. That saved intent says whether the user was trying to sign in with Google or connect Google Calendar from inside an existing session.
When Google redirects back to Compass, the callback page:
/dayas a safe fallbackBackend now validates the Google redirect URI
The backend now derives the expected Google callback URL from the configured frontend URL plus
/auth/google/callback.When exchanging a Google authorization code, the backend rejects requests that do not use that expected callback URL. This keeps the code exchange tied to the Compass instance that initiated the flow.
Removed the old Google popup/overlay path
The old popup-oriented Google auth wrappers and blocking “complete Google sign-in” overlay were removed.
Google authorization now has one loading surface: the callback page that appears after Google redirects back to Compass.
Calendar connect still syncs local user-created events first
For an existing password-authenticated user connecting Google Calendar, Compass still tries to sync pending local events before redirecting to Google.
After Google returns successfully, Compass connects the Google account, refreshes user metadata, and refetches calendar events so the UI moves into the normal import/sync state.
Demo events are no longer uploaded into real accounts
Seeded demo events are now marked locally in IndexedDB.
That marker is used only in browser storage. When local events are synced into a real account, Compass:
This prevents sample events like onboarding/demo calendar entries from becoming real account data.
Docs were updated
The docs now describe the redirect-based Google flow, the new callback URL, and the demo-event sync behavior.
Updated areas include:
Validation
bun run test:webbun run test:backendbun run type-check