我该如何解决这个问题,我已经在我的 Flutter 应用程序中实现了电话身份验证。短信代码已发送到我的设备上,但在验证发送的短信代码时遇到问题。我该如何解决这个问题?
this is the error:
[firebase_auth/invalid-verification-code] The sms verification code used to create the phone auth credential is invalid
这是我的验证电话功能:
await _auth.verifyPhoneNumber(
phoneNumber: _phoneController.text.toString().trim(),
verificationCompleted: (phoneAuthCredential)async{
setState(() {
showloading = false;
});
signInWithPhoneAuthCredentials(phoneAuthCredential);
},
verificationFailed: (verificationFailed)async{
setState(() {
showloading = false;
});
// ${verificationFailed.message}
_scaffoldKey.currentState.showSnackBar(SnackBar(content: new Text("VerificationFailed::${verificationFailed.message}" )));
debugPrint("ERROR PHONE VERIFY::::: ${verificationFailed.message}");
},
codeSent: (verificationId, resendingToken)async{
setState(() {
showloading = false;
currentState = MobileVerificationState.SHOW_OTP_FORM_STATE;
verificationCode = verificationId;
});
},
codeAutoRetrievalTimeout:(verificationId)async{
});