Reputation: 67
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
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?
On Resend OTP click calling Same
window.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('sign-in-button', {
});
Upvotes: 2
Views: 4822
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