Reputation: 10877
I'm having a lot of issues trying to get phone authentication setup on my ionic app. I'm currently trying to a code to send to a phone with cordova-plugin-firebase
and use of the verifyPhone()
function but whenever I try to call it, the app instantly crashes with no errors. I am following the proper +1xxxxxxx phone number format.
The following is the code on my login page:
import { Component } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { Firebase } from '@ionic-native/firebase';
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class LoginPage {
constructor(
public navCtrl: NavController,
public navParams: NavParams,
private FirebasePlugin: Firebase) {
}
ionViewDidLoad() {
console.log('ionViewDidLoad LoginPage');
}
phoneAuth() {
this.FirebasePlugin.verifyPhoneNumber("+1xxxxxxx");
}
}
I have been pulling my hair out for a few days now trying to figure out why this won't work, i've tried setting it up using the regular firebase npm package and using cordova-plugin-firebase-authentication
which was impossible because I could not find any documentation on it whatsoever. I have confirmed that my firebase project has phone auth setup and everything is correct on that end.
Any help would be great, according to the docs for the cordova firebase plugin, this is all I should have to do to get a text from firebase.
Upvotes: 1
Views: 646
Reputation: 62
Have you made sure that your google-settings.json
contains your SHA-1 certificate fingerprint? It's necessary for things like phone verification.
If it doesn't, add your fingerprint and update the google-settings.json
in your project with the new one.
You can find this information in Firebase's Project Overview > Your app (or click on + Add app in case you haven't generated this file yet.)
Hope this helps.
Upvotes: 1