Repository navigation
fix(desktop): let connector sign-in return to the desktop app - #161
Merged
Merged
Conversation
Allow only document GET navigations to the connector OAuth callback while preserving desktop Host checks and all other cross-site restrictions. Bind desktop flows to the BFF process so the system browser can complete sign-in without Electron cookies. Return fixed result copy and a credential-free app link, refresh connector settings, and cover state ownership, expiry and replay. Fixes: #68
This was referenced Nov 13, 2026
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.
In the desktop app, "Sign in with Notion" ended on "Untrusted desktop origin". The provider sends the system browser back to the app's callback. That top-level navigation comes from notion.com, so
Sec-Fetch-Site: cross-site, and the desktop origin check inhooks.server.tsblocked it. The system browser also has no Electron cookie.The exception covers only
GET /api/connectors/oauth/callback:Sec-Fetch-Mode: navigate,Sec-Fetch-Dest: document, when the browser sends them);CANOPY_WEB_ORIGIN, so DNS-rebinding protection stays.POST, fetch, other paths and a foreign Host are still blocked (403). GitHub and MCP OAuth share this callback. Pairing needs no exception.
The callback stays safe:
stateatomic and single-use, with a 10-minute TTL, bound to the owner and the account;After sign-in, a small result page says what happened and offers "Return to Canopy" (
canopy://connectors, which brings the desktop window forward and refreshes the connectors). Errors and replayed states get clear text.Tests:
Checked success, provider error and replay in light and dark, at 1280, 390 and 320 px.
Copy audit (
docs/copy.md§8): the result page states one outcome, then what to do. Text is sentence case, buttons start with verbs, and provider errors are not echoed.Fixes: #68