在 Firebase 身份验证中验证 OTP 时,如何使用电子邮件和密码创建用户帐户?我提供了我尝试使用电子邮件和密码创建用户的代码片段。请为我提供解决方案
private fun signInWithPhoneAuthCredential(
credential: PhoneAuthCredential,
name: String,
email: String,
number: String,
password:String
) {
mAuth.signInWithCredential(credential)
.addOnCompleteListener(requireActivity()) { task ->
if (task.isSuccessful) {
// Sign in success, update UI with the signed-in user's information
// mAuth.currentUser?.verifyBeforeUpdateEmail(email)
homeViewModel.setUserData(mAuth.currentUser?.uid.toString(),name,email,number)
//PhoneAuthProvider.getCredential()
mAuth.createUserWithEmailAndPassword(email,password)
val intent = Intent(requireActivity(), HomeActivity::class.java)
startActivity(intent)
} else {
Toast.makeText(requireActivity(), "OTP is invalid", Toast.LENGTH_SHORT).show()
}
}
}