如何通过verifyPhoneNumber方法知道实际的OTP发送? -颤振

时间:2020-08-22 08:40:19

标签: firebase flutter authentication dart firebase-authentication

只是一个快速问题。在颤抖的电话验证中,有什么方法可以找到通过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")

0 个答案:

没有答案