In Firebase, I register the user with e-mail on the authentication side and after registration I send e-mail verification to this user, but in addition to this, I define some other features in my system, such as name, phone number while registering. I will combine these features and keep them in user collections in firestore. At the same time, I want to send an sms-code to the phone number of the data whose e-mail and password are matched in the user collections with the e-mail and password entered by the user while logging in to the system, and I will instantly verify this every time for the user to log in. Is it possible for me to do something like this or should I just choose one over email or phone?
CodePudding user response:
Yes absolutely it is possible, use both authentication method one by one (email first then phone OTP) and while registering after creating user with email and password and sending otp to the user, instead of doing createUserWithCredentials
use linkUserWithCredentials
. This will create one user with both email and phone number authentication instead of creating two separate users for two different credentials.
CodePudding user response:
This is possible and easily implementable. Kindly check this google documentation You can use multiple Auth https://firebase.google.com/docs/auth/android/account-linking?authuser=0 this is one youtube channel that did the same thing as what you are asking for https://www.youtube.com/watch?v=pQZ_tp1h8B8