Issue
I am trying to send message using signInWithPhoneNumber
from firebase but I am getting following error on implementing , I also imported firebase still same issue.
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);
});
}
}
Solution
You're only importing the core Firebase SDK. In order to use Firebase Authentication, you also need to import that SDK by adding:
import 'firebase/auth';
Answered By - Frank van Puffelen
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.