firebase - 如何在flutter中使用firebase电话身份验证中的forceResendingToken重新发送otp
问题描述
我正在寻找一种在 firebase verifyPhoneNumber 中重新发送OTP的方法。我已经浏览了有关 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。
解决方案
获取
ForceResendingToken
自onCodeSent(String, PhoneAuthProvider.ForceResendingToken) callback
强制在自动检索超时之前重新发送另一个验证短信。
因此,在您的情况下,这将是verifyPhoneNumber()PhoneCodeSent
调用的回调。
推荐阅读
- sql - DATE_SUB 的 Oracle SQL 语法错误问题
- c++ - g++ 和 clang++ 对“sizeof...()”模板值的模板特化的不同行为
- python - pyAudio 上的 stop_stream 功能不起作用,有什么建议吗?
- reactjs - 我无法使用 reactjs 输入输入文本
- ffmpeg - ffmpeg hls_time 选项不适用于 h264_nvenc
- multithreading - JMS 线程中的 MessageListener 对象是什么?
- python - 两个包使用相同的关键字
- java - unsafe.compareAndSwapObject 替换正在另一个线程中迭代的数组
- ios - 为什么我的 Swift 按钮在点击时会显示一个蓝色的小方块?
- python - 从串行写入文件