Flutter + Firebase Auth: Is there any way to resend the SMS verification code with Firebase phone auth on web?

Viewed 819

Problem

I created a "resend SMS" for my login page on mobile, which works just fine, using FirebaseAuth.instance.verifyPhoneNumber() and its forceResendingToken property. When a user presses the "resend SMS" button, the verification code SMS is sent again and the button is disabled for some time (see screenshot).

However, I cannot find anywhere if there is a way to resend the SMS verification code on web. The FirebaseAuth.instance.signInWithPhoneNumber() method does not have a property like forceResendingToken or something like that. So my question is, is there a way to resend the verification code SMS on web using Firebase phone authentication?

I have searched Google, the Fireflutter documentation and Stackoverflow but could not find someone with the same question or other relevant information.

1 Answers

By default, Firebase will not re-send a new SMS message if it has been recently sent. You can however override this behavior by re-calling the verifyPhoneNumber method with the resend token to the forceResendingToken argument. If successful, the SMS message will be resent.

Related