2
votes

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);
});
1
Anything at all in the logcat? Also please rephrase. - shkschneider
Thanks! for making corrections. - Ankit Maheshwari
I could not debug signed app - it does not allow debug. - Ankit Maheshwari
For debug APK it through this error - unknown error verifying number Error instance: com.google.firebase.auth.FirebaseAuthException - Ankit Maheshwari
Please read Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers? - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. - halfer

1 Answers

0
votes

this error is associated with firebase phone auth on emulator as so you are required to provide testing phone number

Go to

firebase console -> Authentication -> SIGN-IN Method -> Phone

and the add a testing phone number.