Skip to content

Commit

Permalink
fix(#245): resolve google sign-in issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sneljo1 committed Mar 4, 2020
1 parent aceb1d8 commit 59fddc0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/main/authWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ export const createAuthWindow = () => {

authWindow.webContents.session.setUserAgent(signInUserAgent);

authWindow.webContents.session.webRequest.onBeforeSendHeaders(
{
urls: ['https://accounts.google.com/*']
},
(details, callback) => {
const newRequestHeaders = { ...(details.requestHeaders || {}), 'User-Agent': signInUserAgent };

callback({ requestHeaders: newRequestHeaders });
}
);

authWindow.setMenu(null);

authWindow.once('ready-to-show', () => {
Expand Down Expand Up @@ -78,7 +89,7 @@ export const createAuthWindow = () => {
}
});

authWindow.webContents.on('will-navigate', (event, url) => {
authWindow.webContents.on('will-navigate', (_, url) => {
if (url.indexOf('error_code') !== -1) {
authWindow?.close();
}
Expand Down

0 comments on commit 59fddc0

Please sign in to comment.