This is my application: https://play.google.com/store/apps/details?id=codechintan.risingbee.android
Firebase authentication with device having app and sim card of number on same device does not work.
It sends OTP, but does not verify and does not respond from function
// sign in with the credential
firebase.auth().signInWithCredential(credential);
It works on other device.
I am using Cordova: https://www.npmjs.com/package/cordova-plugin-firebase. Also using Ionic framework pro to build the app.
Edit 1
We have developed an application in which phone authentication using Firebase is integrated.
We are using plugin and it's code, plugin link - https://www.npmjs.com/package/cordova-plugin-firebase
The Android app is developed using Ionic framework and Cordova.
It's phone authentication does not worked, it sends OTP but phone verification does not works if an app and phone number are in same device.
Example: Number +91 9575XXXXXX is in my phone and if I install an app in that same device the authentication process does not works! It sends OTP but does not verify!
Now, authentication process works if I try another number (SIM card of which number is not in device having app). It's very weird.
Edit 2
I think, it's a problem in plugin (https://www.npmjs.com/package/cordova-plugin-firebase)
When using own mobile number credential.verificationId is getting false! in below function.
window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);
// ask user to input verificationCode:
var code = inputField.value.toString();
var verificationId = credential.verificationId;
//THIS verificationId IS GETTING FALSE!!!
var credential = firebase.auth.PhoneAuthProvider.credential(verificationId, code);
// sign in with the credential
firebase.auth().signInWithCredential(credential);
// call if credential.instantVerification was true (android only)
firebase.auth().signInWithCustomToken(customTokenFromYourServer);
// OR link to an account
firebase.auth().currentUser.linkWithCredential(credential)
}, function(error) {
console.error(error);
});