只是一个快速问题。在颤抖的电话验证中,有什么方法可以找到通过verifyPhoneNumber
方法发送的实际OTP代码。像下面的示例一样,我尝试打印verID
中的smsCodeSent
,将其视为实际的OTP代码,但我错了
var firebaseAuth = await FirebaseAuth.instance;
final PhoneCodeSent smsCodeSent =
(String verID, [int forceCodeResend]) async {
// IS ABOVE PASSED "VERID" the actual code?
// UPON PRINTING THIS "VERID", I'M GETTING BELOW MESSAGE
print("Actual OTP send (verID): " + verID.toString());
....
AuthCredential authCred = PhoneAuthProvider.getCredential(
verificationId: verID, smsCode: OTPDialogResult);
....
};
firebaseAuth.verifyPhoneNumber(
phoneNumber: phone,
timeout: Duration(seconds: 60),
verificationCompleted: verificationCompleted,
verificationFailed: verificationFailed,
codeSent: codeSent,
codeAutoRetrievalTimeout: codeAutoRetrievalTimeout);
verID
优先输出
E/flutter (15012): Actual OTP send (verID): AM5PThDpXIuz5W0UjitB8aCwWk2LhKmNVOIR6DQfBhHzCqG4rpRLpNtCBBL1TSZb_Q0hMoIzUwP_apsqOw2UQbr7SwxSphfhnUGNEUzf_iSQi93IUXcAQButFezjN1FRw1QUmm960nIFpG6_1wjqrvL5tK6Zr6CpRg")