Skip to content

Commit 79edc67

Browse files
steve-cooksclaude
andcommitted
fix(desktop): a cancelled OAuth sign-in no longer blocks the next one
@clerk/electron rejected every new OAuth attempt for 3 minutes while an abandoned one was still pending. Patch it so a new attempt replaces the stale pending flow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent a93b03c commit 79edc67

3 files changed

Lines changed: 31 additions & 3 deletions

File tree

‎patches/@[email protected]‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
diff --git a/dist/cjs/index.js b/dist/cjs/index.js
2+
index 97a5a25d58584c9bf04997fcec67e29923a0cf76..f830912f5b2900f2f96018b723a86c27e105954e 100644
3+
--- a/dist/cjs/index.js
4+
+++ b/dist/cjs/index.js
5+
@@ -95,7 +95,7 @@ function setupOAuthTransportIpcHandlers(options) {
6+
});
7+
electron.ipcMain.handle(require_ipc.OAUTH_TRANSPORT_CHANNELS.open, async (event, url) => {
8+
if (!isMainFrameEvent(event)) throw new Error("Clerk: OAuth request did not originate from a window's main frame.");
9+
- if (pendingOAuthFlow) throw new Error("Clerk: an OAuth flow is already pending.");
10+
+ disposePendingOAuthFlow(new Error("Clerk: OAuth flow was replaced by a new one."));
11+
assertExternalOAuthUrl(url);
12+
const window = electron.BrowserWindow.fromWebContents(event.sender);
13+
const callbackPromise = new Promise((resolve, reject) => {
14+
diff --git a/dist/esm/index.js b/dist/esm/index.js
15+
index 29284ea0e6325afc72024ec8c2e69ab3cb78ad00..e17ac66a597afce4273aa8bdd308a794504a8340 100644
16+
--- a/dist/esm/index.js
17+
+++ b/dist/esm/index.js
18+
@@ -94,7 +94,7 @@ function setupOAuthTransportIpcHandlers(options) {
19+
});
20+
ipcMain.handle(OAUTH_TRANSPORT_CHANNELS.open, async (event, url) => {
21+
if (!isMainFrameEvent(event)) throw new Error("Clerk: OAuth request did not originate from a window's main frame.");
22+
- if (pendingOAuthFlow) throw new Error("Clerk: an OAuth flow is already pending.");
23+
+ disposePendingOAuthFlow(new Error("Clerk: OAuth flow was replaced by a new one."));
24+
assertExternalOAuthUrl(url);
25+
const window = BrowserWindow.fromWebContents(event.sender);
26+
const callbackPromise = new Promise((resolve, reject) => {

‎pnpm-lock.yaml‎

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎pnpm-workspace.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ patchedDependencies:
331331
332332
333333
334+
334335
335336
336337

0 commit comments

Comments
 (0)