如何使用Firebase身份验证重新发送OTP

时间:2019-09-05 07:32:05

标签: javascript firebase firebase-authentication one-time-password

60秒后如何重新发送OTP。使用Firebase库,当前正在使用此
https://github.com/firebase/quickstart-js/blob/master/auth/phone-invisible.html

  1. 在首次发送OTP时称呼它

    window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', { 
    
    }); 
    

    工作正常,发送第一个OTP。但我已经添加了计时器,如果60秒。交叉。它将重新发送OTP按钮

    不是它不发送Next OTP,所以我该如何实现呢?

  2. 在重新发送OTP时单击呼叫Same

    window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', { 
    
    });
    

1 个答案:

答案 0 :(得分:0)

关于重新发送的解决方案,我们不需要在“重新发送”按钮上单击相同的按钮,即“ window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button',{

}); instead we can directly call inner function firebase.auth()。signInWithPhoneNumber(phoneNumber,appVerifier)`,以便重新发送otp。