I'm trying to combine "firebase phone authentication" with ionic.
but, stuck in one question.
I keep getting "Hostname match not found" error from
.catch(function (error) {
console.log("error! : " + error);
});"
of login.ts(below)
import { Component } from '@angular/core';
import { IonicPage, NavController, AlertController } from 'ionic-angular';
import firebase from 'firebase';
@IonicPage()
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
public recaptchaVerifier:firebase.auth.RecaptchaVerifier;
constructor(public navCtrl: NavController, public alertCtrl: AlertController) {}
ionViewDidLoad() {
this.recaptchaVerifier = new firebase.auth.RecaptchaVerifier('recaptcha-
container');
}
signIn(phoneNumber: number){
const appVerifier = this.recaptchaVerifier;
const phoneNumberString = "+" + phoneNumber;
firebase.auth().signInWithPhoneNumber(phoneNumberString, appVerifier)
.then( confirmationResult => {
let prompt = this.alertCtrl.create({
title: 'Enter the Confirmation code',
inputs: [{ name: 'confirmationCode', placeholder: 'Confirmation Code' }],
buttons: [
{ text: 'Cancel',
handler: data => { console.log('Cancel clicked'); }
},
{ text: 'Send',
handler: data => {
confirmationResult.confirm(data.confirmationCode)
.then(function (result) {
}).catch(function (error) {
});
}
}
]
});
prompt.present();
})
.catch(function (error) {
console.log("error! : " + error); // <------------The place that informs this error.
});
}
}
this error occurred shortly after reCAPTCHA solved
Why does this happen?
--Initializing Firebase
--login.html