0

I am trying to implement an OTP system for verifying phone numbers for my Android app. I don't want to reinvent the wheel and so I have been looking at libraries for the same. This question talks about some methods for OTP but the github repo suggested by the accepted answer is quite old. The second answer is something that I could implement, but I would like to use libraries in an app that would be used in production.

I would like to use Firebase Phone Auth for verifying phone numbers as they have suggested here. However, the intended use for it is to sign in users using their phone number. I don't really have any use for the sign-in functionality.

I came up with a solution to my problems with OTP: Use firebase to sign in using OTP and phone number authentication. If the user is successfully signed in, immediately sign him out. The user signing in successfully would mean that he verified his phone number successfully.

Is there any other way that I can do this? Would this method be recommended? Would this cause any side effects?

I realize that another solution would be to simply build a server-client model as described here to implement phone number verification but I was hoping to avoid it. I would go for it though, if I don't have any other way to do it than the one I suggested above.

Rohit Shinde
  • 1,575
  • 5
  • 21
  • 47
  • Firebase Phone Auth can be used to verify phonenumber, A successfull sign in means a verified phone number – Jinson Paul Oct 09 '18 at 03:32
  • After 5 `sign out` in a short amount of time you'll get `FirebaseTooManyRequestsException` while signin in, then you'll have to wait for at least 2 hours. – Bek Oct 09 '18 at 03:48
  • @JinsonPaul yes, I understand that. But is there any side effect to this? – Rohit Shinde Oct 09 '18 at 12:03
  • @Bek are you sure? Is there any way that this can be circumvented? – Rohit Shinde Oct 09 '18 at 12:03
  • Before I got `FirebaseTooManyRequestsException`. Now I tried it and didn't get error. I signed out 20 times in 5 minutes and no error. I think you can use it now. – Bek Oct 09 '18 at 14:07
  • @RohitShinde once you signed in save this number , or verified number details to shared preference or your server db , so you have no need for that functionality later, As far as I know there is no side effect ,, and in India I think 10000 phone verification are allowed by firebase with the free plan – Jinson Paul Oct 10 '18 at 03:59

0 Answers0