简体   繁体   中英

Firebase multiple login method but single user profile

Oo currently I am trying to check and see if its possible to do a single user profile account using firebase authentication under my android project, but here is the kicker which is it should allow me to let my user login using either email, facebook, google, GitHub, etc. from their choosing but after authentication of it, the user is still under 1 account profile, and not separate or a different profile as an example.

sample email from the user :
1. user_gorilla@gmail.com
2. user_apple@yahoo.com
3. hotstuff@hotmail.com
4. this_is_not_a_joke@gmail.com

all of that login and email is just from 1 user and I would want them to have just 1 profile, but enable them to login using multiple emails.

is there currently an in-app function in firebase that does this? or do I have to do and make it myself? because I am currently thinking of doing something along the lines of.

User_profile <- collection name
UID:UID <- this should be the unique document ID 
Fullname:
Emails: <-- separate set of collections where the emails for the specific user is stored.

so this is how it goes when the user is created and signed up, the admin still needs to verify "if" the user already has been made inside the collection of user_profile, and if not then the admin would need to create the user_profile and then give the user their unique ID/key.

each time the user creates a new login credentials/authentication login, they need to register it into the admin so that the UI for the profile will show up for the newly created authentication for the user but would still reflect the old profile of the user, its just that the profile gets updated every time and needs to be added by the admin to do so.

would this work out? or does firebase already have something like this kind of function?

so currently i am trying to check and see if its possible to do a single user profile account using firebase authentication under my android project

According to the official documentation regarding Link Multiple Auth Providers to an Account on Android :

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.

So the key to using this feature is to have the same Firebase user ID.

here is the kicker which is it should allow me to let my user login using either email, facebook, google, github, etc.

Currently, the sign-in methods that are allowed are:

  • Email/Password
  • Phone
  • Google
  • Play Games
  • Game Center (Beta)
  • Facebook
  • Twitter
  • GitHub
  • Yahoo
  • Microsoft

Or even an Anonymous authentication.

from their choosing but after authentication of it, the user is still under 1 account profile, and not separate or a different profile

For example, a user who signed in with a password can link a Google account and sign in with either method in the future.

What you can't do, is to have users like:

  1. user_gorilla@gmail.com
  2. user_apple@yahoo.com
  3. hotstuff@hotmail.com
  4. this_is_not_a_joke@gmail.com

With different Firebase user ID and link them together. Even if they are the same users, without having the same Firebase user ID, there isn't much to do.

is there currently an in app function in firebase that does this?

No, there is not. If you want to have all those users under a single account, you should create your own mechanism.

or do i have to do and make it myself?

Yes, you need to write code for that. You should match those accounts and somehow convert them into a single one.

or does firebase already have something like this kind of function?

No, it doesn't. The only viable option that you have is to link their multiple accounts using auth provider credentials to a single user account.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM