quickstart-android icon indicating copy to clipboard operation
quickstart-android copied to clipboard

How to stop Instant verification in phone number verfication

Open chitrey opened this issue 9 years ago • 46 comments

The phone authentication in firebase has two types of users on successful authentication as provided in the documentation:

Instant verification: in some cases the phone number can be instantly verified without needing to send or enter a verification code.

Auto-retrieval: on some devices, Google Play services can automatically detect the incoming verification SMS and perform verification without user action.

I would like to authenticate the users on the basis of sending SMS instead. So how could it be resolved. I would like to stop instant verification as well as auto retrieval and call the onCodeSent callback each time

Any help would be appreciated.

chitrey avatar Jun 30 '17 01:06 chitrey

@chitrey we don't currently have a way to disable the instant verification or auto retrieval. Both of those are based on SMS though, can you explain why you'd want to turn them off? In our user studies they greatly increase sign up conversion rate.

samtstern avatar Jun 30 '17 18:06 samtstern

Closing this issue as we are not planning to allow disabling this feature for now.

samtstern avatar Jul 06 '17 14:07 samtstern

@samtstern A good reason to allow disabling this feature is for debugging. I cannot recreate the call for "onCodeSent" anymore because of the Instant Verification, which makes it impossible for me to debug my "Enter your verification code" screen anymore. I tried uninstalling the app / removing its data and nothing helps. At least for debugging purposes, we have to have this option. Am I missing something here?

Barackos avatar Jul 07 '17 14:07 Barackos

@Barackos that's a good point. I'll make sure to add that to the feature request internally. One workaround is to use two devices. One one device (with no SIM) enter the phone number of the other device (with a SIM). Then you'll get the code flow.

samtstern avatar Jul 07 '17 15:07 samtstern

Please make a way to disable instant verification, its a pain while debugging.

p.s. I wasted last 2 hours thinking i messed up my perfectly working program :( Thank you for this thread, or i would've gone mad thinking it was my fault.

Aswindev avatar Jul 08 '17 12:07 Aswindev

After verifying the code

PhoneAuthProvider.getCredential(verificationId,code);

onVerificationCompleted is never called. Why?

McLeroy avatar Jul 09 '17 02:07 McLeroy

onVerificationCompleted is only called when instant verification or auto-retrieval occurs.

samtstern avatar Jul 11 '17 00:07 samtstern

I'm interested in disabling instant verification for this reason: https://stackoverflow.com/q/45356169/3889068

grrrian avatar Jul 28 '17 13:07 grrrian

Looks like @isaisachen replied on StackOverflow.

samtstern avatar Jul 31 '17 15:07 samtstern

You can go to settings and disable you sim card. Enable it again and you should start getting verification codes. Though for instant verification I have not come across any way to disable that.

Jitesh291 avatar Oct 24 '17 04:10 Jitesh291

@Jitesh291 I'm confused. "disable your sim card... start getting verification codes" - so I assume it worked for you and you no longer got instant verification? And then what does your last sentence mean? You mean SMS auto-retrieval?

isaisachen avatar Oct 24 '17 05:10 isaisachen

@isaisachen Thing is when you try this for the first time you will get the otp code from Google but the next time you try it, it can cause instant verification to get active. So if you are debugging and having problem with not receiving otp code from google just disable your sim card and enable it again. This will help you in getting the otp codes from google again for one more time until you enter your code and instant verification gets activated again.

Please note: I don't think there is any way you can disable instant verification as of now. But you can always optimize your code in a way it doesn't create any problem for you and your users.

Jitesh291 avatar Oct 24 '17 08:10 Jitesh291

Having the same problem, making it hard to debug the input screen. +1 for the feature request.

andersu avatar Oct 25 '17 15:10 andersu

I tried to pass 0 to timeout parameter in verifyPhoneNumber

docs says: the maximum amount of time you are willing to wait for SMS auto-retrieval to be completed by the library. Maximum allowed value is 2 minutes. Use 0 to disable SMS-auto-retrieval. If you specifies a positive value less than 30 seconds, library will default to 30 seconds.

i've done that but nothing happened

0mar-ahmed avatar Nov 14 '17 13:11 0mar-ahmed

Same happens with me what Omar-ahmed mentions.

Passing 0 still the onCodeAutoRetrievalTimeOut gets called after 30 sec. Is this intended? I know I can do workaround to check if there is SIM available and then do call onCodeAutoRetrievalTimeOut manually. But this seems a bit hacky for me.

janosvig avatar Dec 03 '17 23:12 janosvig

same is the case with me I tried to use 2 mobile phones by putting 1st mobile phone number in 2nd phone(where I am testing app) I get the code in 1st mobile I put it for verification but it is giving error of "invalid code"
PS: I am putting right code (tried many times)

anwarkamal317 avatar Mar 11 '18 11:03 anwarkamal317

onVerificationCompleted is only called when instant verification or auto-retrieval occurs. https://github.com/firebase/quickstart-android/issues/296#issuecomment-314286033 @samtstern please look on this issue

yes its getting call automatically after instant verification but,its not verify the number correctly please look at this link i have explained the problem in detail,please have a look

https://stackoverflow.com/q/58909735/12072674

guruprakash119 avatar Nov 18 '19 08:11 guruprakash119

Please make a way to disable instant verification, its a pain while debugging.

p.s. I wasted last 2 hours thinking i messed up my perfectly working program :( Thank you for this thread, or i would've gone mad thinking it was my fault.

I messed up my last 2 days at this! Refactored my whole code so that's a plus.

meghna-me avatar Dec 14 '19 18:12 meghna-me

i got 3 days to face this probelm.. hahaha

azizainunnajib avatar Dec 21 '19 16:12 azizainunnajib

I had completely forgotten about this thread. I guess those two features are still not available to us developers who prefer "debugging" our app :D

chitrey avatar Jan 23 '20 10:01 chitrey