[英]why i am not getting OTP SMS when using verifyPhoneNumber method of ionic 3 cordova native plugin?
I am using https://github.com/arnesson/cordova-plugin-firebase to implement firebase phone authentication. 我正在使用https://github.com/arnesson/cordova-plugin-firebase来实现Firebase电话身份验证。
When i call verifyPhoneNumber()...It console me verificationId. 当我致电verifyPhoneNumber()...它安慰我verificationId。
this.firebase.verifyPhoneNumber(phoneNumber,60)
.then(
function (verificationId) {
console.log(verificationId)
return verificationId;
}
)
Object {
instantVerification: false,
verificationId: "here verification id"
}
But, it is not sending code to given phone number. 但是,它没有将代码发送到给定的电话号码。
Any help ? 有什么帮助吗?
As i can read in the documentation, they said you need to sign in with you'r credential before send SMS. 正如我在文档中看到的那样,他们说您需要先使用凭据登录,然后再发送SMS。 Maybe you do it before u'r sample code, if you don't you use this instead of you'r code :
也许您在示例代码之前执行此操作,如果您不这样做,则使用它代替您的代码:
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.