Firebase authenication only for one user - firebase

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.

Related

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.

Firebase - Edit other user data

I'm trying to edit email address and password for other user via code. Is this possible to do without Admin SDK? I'm asking because I dont have backend skills yet. Does Firebase have a method to login user via uid? Maybe this way I will made my goal?
Users can only update their own data in mobile apps using the Auth client SDKs. It would be a gigantic security hole if any user could modify or log in as any other user without credentials.

Firebase: Link facebook account with existing user

I have a current database with active users in Firebase that can login with user/pwd but now I'm implementing the facebook login and I realised the only way to link a facebook account with an existing user is only when the user is already logged with the user/pwd but not before the login.
I have two buttons in my app (login with fb and with email) but if I try to login with fb using the same email of an existing user, I will receive the following error auth/account-exists-with-different-credential and the documentation says that in order to fix this the user needs to login first then link.
Do you know if there is a way to link both accounts but without perform a login first, I mean, from the login view?
You need to sign in the user first before linking. This is important if you want to ensure it is the same user. Otherwise you can switch to multiple accounts per email in the Firebase console.
The way to solve this, when you get the error auth/account-exists-with-different-credential, the error will contain error.email and error.credential after you sign in with Facebook and the account already exists as a password account.
You then call firebase.auth().fetchProvidersForEmail(error.email) to which resolves with the list of provider IDs for that email. In this case, it will contain ['password']. You then ask the user to provide their password. You call signInWithEmailAndPassword(error.email, password) to sign-in the original user. You then call firebase.auth().currentUser.linkWithCredential(error.credential) to link the Facebook credential to the password account. Now both accounts are merged and the user can sign in with either.
I fixed it by going to the Firebase console. then head over to the authentication section and select the Settings Tab. Afterwards, go to User account linking and check Create multiple accounts for each identity provider

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

Can we merge an account of many users in the same service into one firebase account

There are many people who own multiple facebook or twitter accounts. And maybe they would like to merge their accounts in another service
Such as, I have 2 facebook accounts and want to access a game from both account. So if one account got deleted, I can login another to got access to the same
Is it possible in firebase? And how could I do?
Yes, Firebase Auth supports that via the Account Linking API.
User login into Firebase with the first Facebook account.
getCurrentUser() gives you the Firebase user.
Prompt the user to login with second Facebook account.
Link the second Facebook token:
getCurrentUser().linkWithCredential(facebookTokenCredential)
For the moment that is not possible. Firebase set an uuid for each facebook account when login for first time.

Resources