react-native-otp-verify icon indicating copy to clipboard operation
react-native-otp-verify copied to clipboard

Otp retrieval only works once

Open jbrodriguez opened this issue 1 year ago • 0 comments

Hi, thanks a lot for the great library !

I'm having the issue that the otp retrieval works only the first time.

If it's a successful retrieval, it's not much of an issue because I can log in the user.

But if there's a timeout or for some error the code is wrong (thinking about user hitting something like a resend code button), then the listener doesn't work.

i was reading google's doc and found this

// Starts SmsRetriever, which waits for ONE matching SMS message until timeout
// (5 minutes). The matching SMS message will be sent via a Broadcast Intent with
// action SmsRetriever#SMS_RETRIEVED_ACTION.
Task<Void> task = client.startSmsRetriever();

ref: https://developers.google.com/identity/sms-retriever/request#2_start_the_sms_retriever

so i was thinking maybe we need to actually create the client again (RNOtpVerify.getOtp()) after a message is retrieved ?

what are your thoughts on this ?

jbrodriguez avatar Jul 05 '22 13:07 jbrodriguez