问题
So, I am trying to create a sign-in and sign-up flow using firebase with primary requirement using phone number.
But I found that I am only able to sing up the user using createUserWithEmailAndPassword only.
Now the issue is how do I sign up the user using phone number.
If not then how does firebase sign in user using phone number?
回答1:
A Firebase Authentication user account is created when signing up/in with phone number when you call the signInWithCredential method. At that point you can get the FirebaseUser object, and the UID from that.
The relevant code from the documentation:
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
if (task.isSuccessful()) {
// Sign in success, update UI with the signed-in user's information
Log.d(TAG, "signInWithCredential:success");
FirebaseUser user = task.getResult().getUser();
// ...
来源:https://stackoverflow.com/questions/59590056/what-will-happen-if-i-sign-in-user-using-phone-number-without-user-creation-in-f