Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Google Sign In not possible from within electron #2478

Closed
TomTomB opened this issue Dec 28, 2019 · 13 comments
Closed

Google Sign In not possible from within electron #2478

TomTomB opened this issue Dec 28, 2019 · 13 comments

Comments

@TomTomB
Copy link

TomTomB commented Dec 28, 2019

Describe your environment

  • Operating System version: Windows 10 Build 1909
  • Browser version: Electron 7.1.7
  • Firebase SDK version: 7.6.1
  • Firebase Product: auth

Describe the problem

I am not able to sign in with my Google account. After clicking the sign in button inside the popup the following message appears:

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.

I´ve already resolved every electron security warning

Steps to reproduce:

I´ve prepared a repo to reproduce this issue. You can find it here

@bojeil-google
Copy link
Contributor

We don't support popup/redirect sign-in operations in Electron. The error message also does not appear to come from our SDK. Are you using the Google sign in library?

@TomTomB
Copy link
Author

TomTomB commented Jan 1, 2020

I´ve read this Medium article about using Firebase with Electron and it´s caveats. After that, I´ve resolved every issue that may appear (like getting Firebase to think its not being ran inside an node env) and created the issue repo mentioned above.
My actual project is using the Firebase SDK wrapped within the Angular/Fire package, nothing else.

@hsubox76
Copy link
Contributor

hsubox76 commented Jan 6, 2020

It seems like this may be an issue with Google Sign-In and not Firebase. It seems from this issue, which is about using Google Sign-In in Electron, without Firebase, that it may have to do with Chrome or some back-end security requirements of Google Sign-In. https://support.google.com/accounts/thread/22873505?hl=en

@TomTomB
Copy link
Author

TomTomB commented Jan 6, 2020

Apparently, for whatever reason, the issue is caused by the User Agent.

Steps to reproduce:

  • Open Dev Tools inside the Google Sign-In popup
  • Open the Network conditions tab (which can be found inside the 3 dot menu -> More Tools -> Network conditions)
  • E.g. choose the "Firefox - Windows" User Agent
  • Reload the page
  • Sign in works

Is there, by any chance, a way to change the User Agent before opening the popup dialog?
I´ve already looked inside the Electron "new-window" Event but without success.
It´s only possible to edit the User Agent via Session.setUserAgent and inside the window.loadUrl options.

@hsubox76
Copy link
Contributor

hsubox76 commented Jan 7, 2020

I don't think the best solution is to have Firebase open up the capability to spoof a different user agent when opening a popup window, it doesn't seem like a good practice in general.

Have you tried using Electron's userAgentFallback as described in this Reddit thread? https://www.reddit.com/r/electronjs/comments/eiy2sf/google_blocking_log_in_from_electron_apps/

@TomTomB
Copy link
Author

TomTomB commented Jan 8, 2020

Me neither. I can confirm that setting app.userAgentFallback to e.g. Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) old-airport-include/1.0.0 Chrome Electron/7.1.7 Safari/537.36 fixes the issue.

Hopefully this workaround won't be need for ever from now on.

RedSparr0w added a commit to RedSparr0w/CSGO-YouTube-Music that referenced this issue Jan 22, 2020
@malcolmdeck
Copy link

It sounds like this issue is resolved - a workaround is explained above, and we don't intend on supporting this directly at this time.

@kbourro
Copy link

kbourro commented May 6, 2020

It seems that user-agent bypass stopped working.

@varun508
Copy link

varun508 commented May 6, 2020

useragentfallback isn't working anymore. Any update on that?

@malcolmdeck
Copy link

Can you please go into a little bit more detail about what's broken with that workaround now? Is it a problem with Google Sign-In or Firebase Auth? What error are you getting? Again, we don't support popup/redirect sign-in operations in Electron, but I'll try to help if I can.

@bartoszhernas
Copy link

The issue is that for some accounts, Google is blocking login page when that page was opened in Electron window. This only happens for some accounts and not all, which is really weird.

Changing user agent of Electron worked for some credentials, but we are still getting errors that users are not able to log in :(

@pejmanjohn
Copy link

I am seeing this issue as well. I have a private Google Spreadsheet in a webview in Electron. In order to view it I have to sign into my Google account first but after I enter my email address and hit continue I see this: "This browser or app may not be secure."

Screen Shot 2020-05-14 at 10 19 17 PM

@tofutim
Copy link

tofutim commented May 28, 2020

the fun may be over :(

@firebase firebase locked and limited conversation to collaborators Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests