0

In a Flutter android app, users should authentificate with Firebase Phone Authentification, so, what I can't do is to save user entered data to cloud firestore like name and phone number in a node named "users".

I can do it with EmailAndPassword Authentification like this :

final FirebaseUser user =
        (await firebaseAuth.createUserWithEmailAndPassword(
                email: _mailTextController.text.trim(),
                password: _passTextController.text.trim()))
            .user;
    firestore.collection('users').document(user.uid.toString()).setData({
      'nom': _nomTextController.text.trim(),
      'email': _mailTextController.text.trim(),
      'userID': user.uid.toString()
    });

Any help with PhoneAuthentification process

1 Answer 1

1

you can save the user phone and number in a similar way as you saved user who signed up with email.

AFter phoneAuth is completed and successful you can get user id and write data to cloud firestore normally.

 firestore.collection('users').document(user.uid.).setData({
  'nom': _nomTextController.text.trim(),
  'name': _name.text,
  'userID': user.uid.toString()
});

you can see how to login with phone auth firebase here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.