How to authenticate a tablet user using firebase phone authentication?

时间:2019-01-18 18:52:30

标签: android firebase firebase-authentication

I've implemented firebase phone authentication in my app and it's working fine when the user uses the app on the phone which the user receives the OTP on. I'm able to verify the OTP perfectly once I receive the OTP on my phone.

But, I just thought of another use case where a user might be using the app on the tablet and when he/she has to verify their mobile number in order to continue using the app. So they enter their mobile number on the tablet and receive the OTP on their phone. In this case, when they enter the OTP they received on their phone in the tablet, I'm not able to verify the OTP since the onVerificationCompleted() method holding null in place of the value.

Can anyone help handle this case gracefully?

Thank you.

1 个答案:

答案 0 :(得分:0)

在这种情况下,您必须使用onCodeSentonCodeAutoRetrievalTimeOut callbacks并要求用户输入代码并初始化PhoneAuthCredential才能完成登录。 / p>