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.