这是我的应用程序:https://play.google.com/store/apps/details?id=codechintan.risingbee.android

在同一设备上具有编号为app和sim卡的设备的Firebase身份验证不起作用。

它发送OTP,但不验证并且不响应功能

// sign in with the credential
firebase.auth().signInWithCredential(credential);


它可以在其他设备上使用。

我正在使用Cordova:https://www.npmjs.com/package/cordova-plugin-firebase
还使用Ionic Framework Pro来构建应用程序。

编辑1

我们开发了一个应用程序,其中集成了使用Firebase的电话身份验证。

我们正在使用插件,它是代码,插件链接-https://www.npmjs.com/package/cordova-plugin-firebase

Android应用程序是使用Ionic框架和Cordova开发的。

它的电话身份验证不起作用,它发送OTP,但是如果应用程序和电话号码在同一设备中,则电话验证不起作用。

例如:电话中有+91 9575XXXXXX,如果我在同一台设备上安装应用程序,则身份验证过程将无法进行!它发送OTP,但不验证!

现在,如果我尝试其他号码(该号码的SIM卡不在具有应用程序的设备中),则身份验证过程将起作用。很奇怪

编辑2

我认为这是插件(https://www.npmjs.com/package/cordova-plugin-firebase)中的问题

使用自己的手机号码credential.verificationId时会出错!
在下面的功能中。



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);
});

最佳答案

此错误与模拟器上的firebase电话身份验证相关,因此您需要提供测试电话号码



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


并添加测试电话号码。

09-10 10:08
查看更多