How to use facebook graph with firebase login?


#1

Hi!, I’m trying to pass facebook information into my firebase database, but I don’t know how to get facebook information using graph v2.10 or with facebook4 . How can I storage the users information when they log in my application?

Here is the code Im using to access facebook using firebase:

facebookLogin(): void {
    if(this.platform.is('cordova')) {
        this.fire.auth.signInWithRedirect(new firebase.auth.FacebookAuthProvider())
            .then(res => {
                firebase.database().ref(`/userProfile/${res.credential.accessToken}/facebook/`).update({
                    uid: res.user.uid,
                    email: res.user.email
                });
                this.navCtrl.setRoot(HomePage);
            });
    } else {
        this.fire.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider())
            .then(res => {
                firebase.database().ref(`/userProfile/${res.credential.accessToken}/facebook/`).update({
                    uid: res.user.uid,
                    email: res.user.email
                });
                this.navCtrl.setRoot(HomePage);
            });

    }

  }

So as you see right now Im storing the email and basic information, but I want location, gender birth etc… How can I get that?

Thanks :slight_smile: