我正在寻找一种重新发送Firebase verifyPhoneNumber中的 OTP 的方法。 我已完成关于example的phoneAuth的工作,但找不到重新发送OTP的方法。 有一个forceResendingToken选项
final PhoneCodeSent codeSent =
(String verificationId, [int forceResendingToken]) async {
this.verificationId = verificationId;
_smsCodeController.text = testSmsCode;
};
await FirebaseAuth.instance.verifyPhoneNumber(
phoneNumber: this._phone,
codeAutoRetrievalTimeout: autoRetrieval,
codeSent: smsCodeSent,
forceResendingToken: ,//how to get this token
timeout: const Duration(seconds: 40),
verificationCompleted: verifSuccessful,
verificationFailed: verifFailed);
}
如何使用此令牌重新发送OTP。
答案 0 :(得分:0)
来自Firebase reference documentation:
从
onCodeSent(String, PhoneAuthProvider.ForceResendingToken) callback
获得的ForceResendingToken
强制在自动检索超时之前重新发送另一个验证SMS。
因此,在您的情况下,这将是PhoneCodeSent
调用的verifyPhoneNumber()回调。