Hello. I am writing a program that takes a 6 digit code using firebase (about authentication).
In my Android environment, my code works so I can get a 6 digit code and log in, but in the ios environment I get an error.
RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.
How can i solve it?
It’s part of my code.
export class CertifiedPage {
recaptchaVerifier;
confirmationResult: firebase.auth.ConfirmationResult;
otpSent = false;
phoneNumber: number;
otp: any;
pNumber: any;
name = '';
mycountry = '';
firemain = firebase.database().ref();
constructor(public navCtrl: NavController, public alertCtrl: AlertController, public af: AngularFireAuth, public zone: NgZone) {
}
ionViewDidLoad() {
this.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-container', {
'size': 'invisiable'
});
}
sendOTP() {
console.log('sendotp');
this.pNumber = String(this.phoneNumber);
this.pNumber = this.mycountry + this.pNumber;
var iosNumber = String(this.phoneNumber);
iosNumber = this.mycountry + iosNumber.replace(/(^0+)/, "");
console.log(iosNumber);
console.log(this.phoneNumber)
console.log(this.mycountry)
console.log(this.pNumber);
this.af.auth.signInWithPhoneNumber(iosNumber, this.recaptchaVerifier).then((result) => {
this.otpSent = true;
this.confirmationResult = result;
this.create_alert('phone', 'ok')
}).catch(err => {
alert(err);
console.log(err);
})
}
verifyOTP() {
console.log('verifyotp')
this.otp = '' + this.otp
this.confirmationResult.confirm(this.otp).then(() => {
this.create_alert('phone', 'ok')
localStorage.setItem('phone', String(this.phoneNumber));
this.userdataupdate()
}).catch(err => {
alert(err);
})
}