Skip to content

Commit 01dfea0

Browse files
steve-cooksclaude
andcommitted
fix(desktop): an invalid OAuth URL no longer cancels a pending sign-in
Validate the URL before replacing the pending flow. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 15dacc4 commit 01dfea0

2 files changed

Lines changed: 12 additions & 10 deletions

File tree

‎patches/@[email protected]‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
diff --git a/dist/cjs/index.js b/dist/cjs/index.js
2-
index 97a5a25d58584c9bf04997fcec67e29923a0cf76..89a09e487f213c90057779b1670345eb3203e87e 100644
2+
index 97a5a25d58584c9bf04997fcec67e29923a0cf76..8fa6d6422188dc720e6de3672ba77e79617526bd 100644
33
--- a/dist/cjs/index.js
44
+++ b/dist/cjs/index.js
5-
@@ -95,7 +95,7 @@ function setupOAuthTransportIpcHandlers(options) {
5+
@@ -95,8 +95,8 @@ function setupOAuthTransportIpcHandlers(options) {
66
});
77
electron.ipcMain.handle(require_ipc.OAUTH_TRANSPORT_CHANNELS.open, async (event, url) => {
88
if (!isMainFrameEvent(event)) throw new Error("Clerk: OAuth request did not originate from a window's main frame.");
99
- 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."));
1110
assertExternalOAuthUrl(url);
11+
+ disposePendingOAuthFlow(new Error("Clerk: OAuth flow was replaced by a new one."));
1212
const window = electron.BrowserWindow.fromWebContents(event.sender);
1313
const callbackPromise = new Promise((resolve, reject) => {
14+
pendingOAuthFlow = {
1415
@@ -109,10 +109,11 @@ function setupOAuthTransportIpcHandlers(options) {
1516
window
1617
};
@@ -38,18 +39,19 @@ index 310c21a720e7b5da06ee301f6b51597f081a8179..3518d29e786258065bc5ab92b664ea06
3839
};
3940
if (process.contextIsolated) electron.contextBridge.exposeInMainWorld("__clerk_internal_electron", bridge);
4041
diff --git a/dist/esm/index.js b/dist/esm/index.js
41-
index 29284ea0e6325afc72024ec8c2e69ab3cb78ad00..091dc64206c0331b0e3663ee08da1d586b16a08d 100644
42+
index 29284ea0e6325afc72024ec8c2e69ab3cb78ad00..80c64fd8dbaefb4a393cc814a273620f77ca76c6 100644
4243
--- a/dist/esm/index.js
4344
+++ b/dist/esm/index.js
44-
@@ -94,7 +94,7 @@ function setupOAuthTransportIpcHandlers(options) {
45+
@@ -94,8 +94,8 @@ function setupOAuthTransportIpcHandlers(options) {
4546
});
4647
ipcMain.handle(OAUTH_TRANSPORT_CHANNELS.open, async (event, url) => {
4748
if (!isMainFrameEvent(event)) throw new Error("Clerk: OAuth request did not originate from a window's main frame.");
4849
- if (pendingOAuthFlow) throw new Error("Clerk: an OAuth flow is already pending.");
49-
+ disposePendingOAuthFlow(new Error("Clerk: OAuth flow was replaced by a new one."));
5050
assertExternalOAuthUrl(url);
51+
+ disposePendingOAuthFlow(new Error("Clerk: OAuth flow was replaced by a new one."));
5152
const window = BrowserWindow.fromWebContents(event.sender);
5253
const callbackPromise = new Promise((resolve, reject) => {
54+
pendingOAuthFlow = {
5355
@@ -108,10 +108,11 @@ function setupOAuthTransportIpcHandlers(options) {
5456
window
5557
};

‎pnpm-lock.yaml‎

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

0 commit comments

Comments
 (0)