There isn'y enough documentation on this subject. so I'm looking for some experiences from amazing people out here.
We need the main sign in method in the app to be using phone number as user name and user chosen password, Phone will be verified with OTP upon registration and when resetting password.
Flutter offers sign in using phone verification, as far as I know each time user has to go through OTP. I need the user to set a password and only verify phone once at signup or when resetting password.
also we wanna link the credentials to a firestore user profile (name, job, email, etc). How would we do that?
Code for sign in using email:
CustomMaterialButton(
onPressed: () async {
try {
final UserCredential _userCredential =
await _firebaseAuth.signInWithEmailAndPassword(email: _user.email, password: _user); //_user is a custom made class that has user profile data
if (_userCredential != null) Navigator.pushNamed(context, HomeScreen.screenId);
} catch (e) {
showCustomSnackBar(context, e.message);
}
},
text: "Log in"),
code for sign up:
CustomMaterialButton(
onPressed: () async {
try {
final UserCredential _newUserCredential =
await _firebaseAuth.createUserWithEmailAndPassword(email: _user.email, password: _user.password);
if (_newUserCredential != null) {
Navigator.pushNamed(context, VerifyPhoneScreen.screenId);
}
} catch (e) {
showCustomSnackBar(context, e.message);
}
},
text: "New user signup"),