[英]why i am not getting OTP SMS when using verifyPhoneNumber method of ionic 3 cordova native plugin?
我正在使用https://github.com/arnesson/cordova-plugin-firebase来实现Firebase电话身份验证。
当我致电verifyPhoneNumber()...它安慰我verificationId。
this.firebase.verifyPhoneNumber(phoneNumber,60)
.then(
function (verificationId) {
console.log(verificationId)
return verificationId;
}
)
Object {
instantVerification: false,
verificationId: "here verification id"
}
但是,它没有将代码发送到给定的电话号码。
有什么帮助吗?
正如我在文档中看到的那样,他们说您需要先使用凭据登录,然后再发送SMS。 也许您在示例代码之前执行此操作,如果您不这样做,则使用它代替您的代码:
window.FirebasePlugin.verifyPhoneNumber(number, timeOutDuration, function(credential) {
console.log(credential);
// ask user to input verificationCode:
var code = inputField.value.toString();
var verificationId = credential.verificationId;
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);
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.