From 83e7fd38d6859bd6d74b0348dd4c29a0c5f8b4b2 Mon Sep 17 00:00:00 2001 From: Vulich Fernando <46904390+fvulich@users.noreply.github.com> Date: Fri, 6 Dec 2019 11:30:00 -0300 Subject: [PATCH] Fix: Google login issue "You are trying to sign in from a browser or app that doesn't allow us to keep your account secure" Fixes: #2495 --- app/ux/WebView.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/app/ux/WebView.js b/app/ux/WebView.js index 01538720..e275ec73 100644 --- a/app/ux/WebView.js +++ b/app/ux/WebView.js @@ -285,6 +285,13 @@ Ext.define('Rambox.ux.WebView',{ // Show and hide spinner when is loading webview.addEventListener("did-start-loading", function() { console.info('Start loading...', me.src); + + webview.getWebContents().session.webRequest.onBeforeSendHeaders((details, callback) => { + let googleLoginURLs = ['accounts.google.com/signin/oauth', 'accounts.google.com/ServiceLogin'] + googleLoginURLs.forEach((loginURL) => { if ( details.url.indexOf(loginURL) > -1 ) details.requestHeaders['User-Agent'] = 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:70.0) Gecko/20100101 Firefox/70.0'; }) + callback({ cancel: false, requestHeaders: details.requestHeaders }); + }); + if ( !me.down('statusbar').closed || !me.down('statusbar').keep ) me.down('statusbar').show(); me.down('statusbar').showBusy(); });