我在Firebase中无法读取未定义错误的属性“ verifyPhoneNumber”以进行电话身份验证。
我从'firebase'中添加了import *作为firebase; 然后通过将插件添加到项目的config.xml中来安装插件
<plugin name="Cordova-plugin-firebase" spec="^2.0.0" />
还安装此插件:
ionic Cordova plugin add https://github.com/jestcastro/cordova-plugin-firebase.git --save
verificationId:any;
code: string="";
send(){
console.log('in send function');
(<any>window).FirebasePlugin.verifyPhoneNumber("+91**********",60,(credential)=>{
alert('SMS Sent Successfully');
console.log(credential);
this.verificationId =credential.verificationId;
},function(error){
console.error(error);
});
}
verify(){
console.log('in verify function');
let signInCredential = firebase.auth.PhoneAuthProvider.credential(VerificationId,Code);
firebase.auth().signInWithCredential(signInCredential).then((info)=>{
console.log(info);
},(error)=>{
console.log(error)
});
}
我除了要在给定的手机号上发送OTP并进行验证。