Firebase phone authentication works perfectly when the app is installed through android studio. I have checked in the SHA which are included in the play Console (there are 3 pairs of SHA1 and SHA256 keys).
When I use the app installed from the play store. It sends the OTP but can not verify it. This is the error
java.lang.IllegalArgumentException: Cannot create PhoneAuthCredential without either verificationProof, sessionInfo, temporary proof, or enrollment ID.
I am sure there is no problem in code as it ran perfectly in android studio mode. But still.. here is my code. GET OTP
val options = PhoneAuthOptions.newBuilder(mAuth)
.setPhoneNumber("+91$s") // Phone number to verify
.setTimeout(60L, TimeUnit.SECONDS) // Timeout and unit
.setActivity(this) // Activity (for callback binding)
.setCallbacks(mCallBack) // OnVerificationStateChangedCallbacks
.build()
try{ Log.d("otpE", PhoneAuthProvider.verifyPhoneNumber(options).toString()) }
catch(err:Exception) {
Log.d("OTP ERROR", err.toString())
}
Verify OTP
mAuth.signInWithCredential(credential)
.addOnCompleteListener(object : OnCompleteListener<AuthResult?> {
override fun onComplete(task: Task<AuthResult?>) {
if (task.isSuccessful) {
...
}