rahul patil
rahul patil

Reputation: 67

how to achive resend OTP using firebase auth

how can Resend OTP after 60 sec. using firebase library, currently using this
https://github.com/firebase/quickstart-js/blob/master/auth/phone-invisible.html

  1. called this on first Send OTP

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

    Working fine its sending first OTP. but i have added timer if 60 sec. cross. it will Resend OTP button

    not its not send Next OTP so how can I achvie That?

  2. On Resend OTP click calling Same

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

Upvotes: 2

Views: 4822

Answers (1)

rahul patil
rahul patil

Reputation: 67

Got the solution: On Resend we don't need to call the same Resend Button Click i.e.

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

instead, we can directly call the inner function

firebase.auth().signInWithPhoneNumber(phoneNumber, appVerifier)

so OTP will be resent.

Upvotes: 3

Related Questions