From 6873dc82936846e9f90ec8e73e701e56745f74c9 Mon Sep 17 00:00:00 2001 From: Mateusz Pietryga Date: Tue, 16 Apr 2024 11:35:13 +0200 Subject: [PATCH] OAuth2: Implement OAuth 2.0 Implicit Grant - Ignore redirect abortion emitted by loadUrl #2056 #1959 --- .../src/ipc/network/authorize-user-in-window.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/bruno-electron/src/ipc/network/authorize-user-in-window.js b/packages/bruno-electron/src/ipc/network/authorize-user-in-window.js index 51ba8b654e..79cf86a850 100644 --- a/packages/bruno-electron/src/ipc/network/authorize-user-in-window.js +++ b/packages/bruno-electron/src/ipc/network/authorize-user-in-window.js @@ -174,6 +174,11 @@ const authorizeUserInWindowImplicit = ({ authorizeUrl, callbackUrl, session }) = try { await window.loadURL(authorizeUrl); } catch (error) { + // If browser redirects before load finished, loadURL throws an error with code ERR_ABORTED. This should be ignored. + if (error.code === 'ERR_ABORTED') { + console.debug('Ignoring ERR_ABORTED during authorizeUserInWindow'); + return; + } reject(error); window.close(); }