Rocket.Chat.Electron icon indicating copy to clipboard operation
Rocket.Chat.Electron copied to clipboard

Can't login with Google OAuth on Windows/Linux/macOS clients with 2.17.2

Open dudognon opened this issue 6 years ago • 35 comments

My Setup

  • Operating System: Windows 10
  • App Version: 2.17.1 / 2.17.2
  • Installation type: exe
  • [x] I have tested with the latest version (2.17.2)
  • [x] I can simulate the issue easily

Description

I can't login using Google OAuth. I get an error message (see screenshot: https://ibb.co/Zx5tYtw) and the following link: https://support.google.com/accounts/answer/7675428?hl=en

No issue on MacOS.

To reproduce:

  • logout
  • and try to login again

Current Behavior

I get an error message when I try to use Google OAuth to login

Expected Behavior

The login process using Google OAuth

dudognon avatar Dec 30 '19 14:12 dudognon

Same issue on Mac Client v2.16.0

lionel-gattegno avatar Jan 07 '20 13:01 lionel-gattegno

Same issue ("This browser or app may not be secure.") on 2.17.2 client, macOS 10.15.2, connecting to server 2.4.1

image

I tried everything that Google suggests (try to allow less secure apps, use app passwords) with no success. I suppose it's the result of their ban of Electron apps (more details on Reddit). The offered solution is to remove "Electron" from User Agent header that is sent by the app.

Aldekein avatar Jan 15 '20 07:01 Aldekein

This also occurs on the Linux client

expired00 avatar Jan 16 '20 17:01 expired00

Confirmed....Linux client broken.

wicadmin avatar Feb 01 '20 18:02 wicadmin

So this thread should be renamed to "Can't login with Google OAuth on Windows/Linux/macOS" in some way.

Aldekein avatar Feb 05 '20 09:02 Aldekein

I've confirmed changing the user agent on the session resolves this problem in Linux. in src/main.js const initialize = async () => { prepareApp(); await app.whenReady(); createMainWindow(); session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { details.requestHeaders['User-Agent'] = 'Google Chrome'; callback({ cancel: false, requestHeaders: details.requestHeaders }); }); };

expired00 avatar Feb 05 '20 19:02 expired00

Could someone confirm it for version 2.17.5? I didn't have any issue with Google OAuth this week.

tassoevan avatar Feb 06 '20 14:02 tassoevan

Same issue, freshly installed from the snap store 2020-02-06 08_18_23-Window

expired00 avatar Feb 06 '20 16:02 expired00

One additional question: is 2FA enabled on the account? AFAIK Google blocks non-2FA authentications outside Google Chrome unless "Less secure app access" is checked.

tassoevan avatar Feb 06 '20 17:02 tassoevan

2FA is enabled on the account. The above screen appears after typing in the e-mail address and password.

expired00 avatar Feb 06 '20 17:02 expired00

Confirming I'm seeing the same as @expired00 on 2.17.5 Linux and Mac clients.

DeviaVir avatar Feb 07 '20 09:02 DeviaVir

Same issue. My gmail account is already configured to allow rocket chat to access, but after upgrading to 2.17.7 I can't login with oauth using the gmail account because I get the error "This browser or app may not be secure. Try using a different browser. If you’re already using a supported browser, you can refresh your screen and try again to sign in."

SarahBaghdadi avatar Feb 15 '20 21:02 SarahBaghdadi

After adding the following to src/main.js I was able to remove the message regarding the insecure browser:

const prepareApp = () => {
  setupErrorHandling('main');
+  app.userAgentFallback = app.userAgentFallback.replace('Electron/' + process.versions.electron, 'Electron');
+  app.userAgentFallback = app.userAgentFallback.replace('Chrome/' + process.versions.chrome, 'Chrome');

Which allows for the full sign in and redirect back to the app...but am given the saml error of "No matching login attempt found". Looks like something isn't capturing the creds somewhere along the path...

@tassoevan Hopefully you have something up your sleeve to fix that capturing phase?

AgentTNT avatar Mar 01 '20 17:03 AgentTNT

I should add that I was making those changes on the base 2.17.7 tag code on a Mac OSX 10.15.3, with the backend being RC 3.0.2

AgentTNT avatar Mar 01 '20 20:03 AgentTNT

Any resolution to this?

https://support.google.com/accounts/answer/7675428?hl=en

tymat avatar Mar 13 '20 21:03 tymat

@tassoevan I think to solve this we can shift the social logins to browser and then redirect back to the app. Is this approach fine?

abhigyank avatar Mar 28 '20 18:03 abhigyank

Would it be possible to just change the User-Agent to something like "Chrome/Rocket.Chat" to avoid this issue? (cf the Reddit thread already linked above)

rnsc avatar Apr 01 '20 15:04 rnsc

Would it be possible to just change the User-Agent to something like "Chrome/Rocket.Chat" to avoid this issue? (cf the Reddit thread already linked above)

That's what I've done in my own dev version and it's working fine.

expired00 avatar Apr 01 '20 15:04 expired00

That's what I've done in my own dev version and it's working fine.

Where do we make this change?

wicadmin avatar Apr 01 '20 16:04 wicadmin

I've confirmed changing the user agent on the session resolves this problem in Linux. in src/main.js const initialize = async () => { prepareApp(); await app.whenReady(); createMainWindow(); session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { details.requestHeaders['User-Agent'] = 'Google Chrome'; callback({ cancel: false, requestHeaders: details.requestHeaders }); }); };

I mentioned this above in an earlier comment, add the session.defaultSession.webRequest.onBeforeSendHeaders((details, callback) => { details.requestHeaders['User-Agent'] = 'Google Chrome'; callback({ cancel: false, requestHeaders: details.requestHeaders }); }); to the initialize

expired00 avatar Apr 01 '20 17:04 expired00