【发布时间】:2021-10-23 19:04:58
【问题描述】:
我正在尝试使用来自 firebase 的 signInWithPhoneNumber 发送消息,但在实施时出现以下错误,我还导入了 firebase 仍然是同样的问题。
import firebase from 'firebase/app';
import { environment } from 'src/environments/environment';
export class TabPage implements OnInit{
code: string = '+91';
spin: boolean = false;
otpSent:boolean = false;
recaptchaverifier;
confirmationResult: firebase.auth.ConfirmationResult;
phoneNumber: string;
ngOnInit(){
this.recaptchaverifier = new firebase.auth.RecaptchaVerifier('recaptcha-container');
this.sendOTP();
}
sendOTP(){
var phNo = this.code+'******';
this.spin = true;
firebase.auth().signInWithPhoneNumber(phNo,this.recaptchaverifier).then(result=>{
this.phoneNumber = phNo;
this.otpSent = true;
this.confirmationResult = result;
this.spin = false;
console.log(result);
}).catch(err=>{
this.spin = false;
alert(err);
});
}
}
【问题讨论】:
标签: javascript angular firebase ionic-framework firebase-authentication