Firebase: Is it possible to allow both Google Auth and Email Auth for single account? - firebase

I have project which has both an Android app and a Python Desktop-app (using pyrebase).
I'm using firebase for Authentication. For the Android, I've enabled both Google Authentication and Email Authentication.
For the Python, just email authentication (there doesn't seem to be a nice way to do Google Auth from python).
I have "Link accounts that use the same email" checked in Firebase Authentication Settings. Now suppose I:
Create user account with Email in desktop, and log in to it.
Sign in with Google Auth using the same email in android.
Try to log in again in desktop with same user-name and password.
Guess what happens? Log in does not work - the Google auth has "taken over" that account and is now the only way to authenticate (which means the account cannot be used from the desktop-app anymore)
Question: Is there any way to allow users to log into the SAME user account through EITHER google-auth OR email?

Related

Firebase authenication only for one user

I made a website and setup up a firebase signup for it. But I don't want users to signup with their emails. As the Website should be only accessed by a specific email and password which I would provide. How can I setup this functionality. Can someone explain the process.
Create the email/password account manually in the Firebase console
Give the account information to the user
Code the account password to the user, and code a way for them to sign in with the Firebase Auth SDK.

Why is it possible to send a password reset email to external provider with Firebase AUth Api?

I am currently developing an angular+ionic app. Everything is working ok but I got a question with the forgot password workflow: sendPasswordRestEmail -> user clicks link -> user fill form -> user submit form -> password and oobCode send with the firebase auth api, which I am accessing through angular fire package.
As I said everything is working as intended. The only "issue" I see is that firebase not only sends password reset email to user that created their account with an email/password but also users that are using an external provider like Google ( sign in with google). I havent test login with Facebook at this point but it is happening with google provider. I just want to make sure if this is the intended workflow or something may be wrong... a bug or something? before I post an issue on github, because even though the user can "change its password" when using an external provider, it is having no effect on their external account(gmail account) which of course should have no effect.
Sending a password reset email from Firebase allows the user to reset the password on their Firebase Authentication account. It has nothing to do with the password they may have with any social provider associated with that account.

social login using firebase with same provider gives "An account already exists with the same email address"

I implemented social login using firebase SDK and i tried login using my facebook account l got this error
An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address
Note
I have only facebook and twitter login in my app and my facebook email not have twitter
when I reviewed user at firebase console l already have user with this email that was registered by facebook (the same provider)
How can the same provider generate different credentials?
You get this error when the user already signed in with the same email using a different provider. eg. user signs up with Twitter using user#example.com and then signs in with Facebook using user#example.com.
Since one account per email is enabled in the project settings, the only way to recover in this case is to sign in with the first provider (Twitter in the example above) and then linkWithCredential the Facebook credential to the existing Twitter account. By doing so, the user can sign in to the same account with either provider in the future.
Firebase Auth does this for security reasons. They want to verify that this is the same user signing in and do not want to automatically link without verifying the user's ownership of both account.

Firebase disable automatic login account creation

I am building a web and mobile app using firebase. When signing with Google, firebase auto creates a new account in the project (Auth) if one does not exist. Its fine with the mobile app.
But with the web, I just want existing users (who created accounts with mobile app) to signin and not create new accounts via web.
How do I setup firebase not to create new accounts if one does not exist?
There isn't a way to restrict social sign-in with Firebase Auth to "only sign in, not sign up".
If you have a means of detecting users that have signed in using the app at some point (e.g. by writing a value to your database in a specific location), you could check for that value when signing in via the web, and, if missing, display a screen encouraging users to install the mobile app.
I think this is what you are looking for:
Link Multiple Auth Providers to an Account Using
JavaScript
You can allow users to sign in to your app using multiple
authentication providers by linking auth provider credentials to an
existing user account. Users are identifiable by the same Firebase
user ID regardless of the authentication provider they used to sign
in. For example, a user who signed in with a password can link a
Google account and sign in with either method in the future. Or, an
anonymous user can link a Facebook account and then, later, sign in
with Facebook to continue using your app.

Lose password after sign in using Google provider

I have an Android app with use Firebase authentication using email and password. Recently added Google provider now my users can sign in wih his Google account, the problem is the following
There's an existing user example#gmail.com registered on my app, later the user sign in with his Google account Firebase automatically change the provider of the account from email to Google, the problem the user sign out and try to login with his email/password and got a message
The password is invalid or the user does not have a password
I understand why happens, but users (you know they are users) get frustrated because can't login with his email/password
There's some way to tell Firebase to keep the user password or when a user login with Google and this convertion happens in order to notify to user
Note My app only allow one account per email
I found there's a method fetchProvidersForEmail I asume I can build a flow over that method that check which provider have the user and allow the user chose if want to keep if old password by asking and linking account or just continue

Resources