Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Browser or app may not be secure. Try using a different browser." error with Flutter Firebase Google Login

I am using flutter web and firebase authentication to build a web app. For that 1. Created Firebase app with Google signin as one of the sign in methods. 2. Added the dependencies as given in https://github.com/FirebaseExtended/flutterfire/tree/master/packages/firebase_auth/firebase_auth/example and https://dart-pub.mirrors.sjtug.sjtu.edu.cn/packages/firebase_auth_web.

When I try to login, the Google sign-in window appears. Once I enter the email address and press enter, it gives the following error.

"Couldn't sign you in 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 used Chrome browser. What should I do to make my app more secure ? For android, we had the option of using SHA keys to encrypt the connection. Do we need to do something similar for web ?

like image 277
vzurd Avatar asked Dec 25 '19 18:12

vzurd


People also ask

Why can't I sign in to Google Chrome with flutter?

Not having 2-factor authentication enabled on the account might be part of it but not sure. This problem isn't specific to flutter. It happens whenever you try to sign in to Google in a Chrome instance that has debugging turned on.

How to authenticate using Firebase Auth in flutter?

If you want to authenticate using email/password then check this tutorial: Using Firebase Auth In Flutter. This is an important step. To be able to use Google sign-in, then you need to generate the SHA-1 key. This key will be used by Firebase to create an OAuth2 client and API key for your app. Therefore in the terminal, execute:

Why do we sign in to Firebase and then log out?

The reason we sign in to Firebase, so later when we call currentUser we can access the email/name/and photo url of the user. Also, in the above class we have the method signOutFromGoogle (), which we will use to log out from both Firebase and Google sign-in.

How to enable Google Sign-in in Firebase?

Now before working on the application, you need to navigate to the Firebase console and enable google sign-in. Therefore navigate to the Authentication tab and then click Sign-in method. You will find multiple providers, but for this tutorial you only need to enable the Google provider:


3 Answers

Incomplete answer:

This problem isn't specific to flutter. It happens whenever you try to sign in to Google in a Chrome instance that has debugging turned on. In other words, if you, your automation software, or IDE starts up chrome with a command like chrome.exe --remote-debugging-port=9222

If running Chrome normally (out of debug mode) is not an option, then try https://support.google.com/accounts/thread/22873505?msgid=24501976 or if you are using Electron then try https://support.google.com/accounts/thread/22873505?msgid=24503570 but I, personally, haven't been able to make these work for me, yet.

Please upvote the question at https://support.google.com/accounts/thread/25209002 if you want a solution to this problem that actually works.

like image 179
davidbludlow Avatar answered Oct 19 '22 04:10

davidbludlow


The issue was with the chrome developer version Flutter use to launch as a device. If we open the same URL (localhost:portnumber) in the normal chrome, it will work without any issue.

like image 34
vzurd Avatar answered Oct 19 '22 03:10

vzurd


The following worked for me:

Go into your google account

  1. select Manage Account
  2. Security
  3. Less secure app access (need to scroll down a little bit)
  4. set to off

Then I was able to login in and debug in IntelliJ

(for me, for some reason, I had to create a new google account, couldn't get it working with my existing account but it worked with my new account)

like image 1
atreeon Avatar answered Oct 19 '22 04:10

atreeon