Can't login with Google OAuth on Windows/Linux/macOS clients with 2.17.2
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
Same issue on Mac Client v2.16.0
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

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.
This also occurs on the Linux client
Confirmed....Linux client broken.
So this thread should be renamed to "Can't login with Google OAuth on Windows/Linux/macOS" in some way.
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 });
});
};
Could someone confirm it for version 2.17.5? I didn't have any issue with Google OAuth this week.
Same issue, freshly installed from the snap store

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.
2FA is enabled on the account. The above screen appears after typing in the e-mail address and password.
Confirming I'm seeing the same as @expired00 on 2.17.5 Linux and Mac clients.
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."
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?
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
Any resolution to this?
https://support.google.com/accounts/answer/7675428?hl=en
@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?
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)
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.
That's what I've done in my own dev version and it's working fine.
Where do we make this change?
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