From 12263a71b6a6974198bc6bee196f85a033fb9bcd Mon Sep 17 00:00:00 2001 From: Mateusz Pietryga Date: Mon, 15 Apr 2024 19:16:46 +0200 Subject: [PATCH] fix: Oauth2: Reuse TLS Certifcate valiadation and custom CA settings from preferences when accessing Auth and Token URLs (#2071) #1684 #1003 --- .../src/ipc/network/authorize-user-in-window.js | 7 +++++++ 1 file changed, 7 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 903ba846f..3ed05d45c 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 @@ -1,4 +1,5 @@ const { BrowserWindow } = require('electron'); +const { preferencesUtil } = require('../../store/preferences'); const authorizeUserInWindow = ({ authorizeUrl, callbackUrl, session }) => { return new Promise(async (resolve, reject) => { @@ -22,6 +23,12 @@ const authorizeUserInWindow = ({ authorizeUrl, callbackUrl, session }) => { }); window.on('ready-to-show', window.show.bind(window)); + // We want browser window to comply with "SSL/TLS Certificate Verification" toggle in Preferences + window.webContents.on('certificate-error', (event, url, error, certificate, callback) => { + event.preventDefault(); + callback(!preferencesUtil.shouldVerifyTls()); + }); + function onWindowRedirect(url) { // check if the url contains an authorization code if (new URL(url).searchParams.has('code')) {