title: How to get Facebook public profile data using angularfire auth, firebase in an Ionic 2 App
body: <p>I'm trying to get data from users' Facebook pages who login/signup in my app with Facebook like birthday, images, gender etc. Right now I'm just adding arbitrary values to my database but I want to get their gender, profile picture url, and birthday if possible. For the life of me I can't figure out how to do it. Here's what I have so far:</p>
  
  <pre><code>loginWithFacebook() {
  return Observable.create(observer =&gt; {
    if (this.platform.is('cordova')) {
      Facebook.login(['public_profile', 'email']).then(facebookData =&gt; {
        console.log(facebookData);
        let provider = firebase.auth.FacebookAuthProvider.credential(facebookData.authResponse.accessToken);
        firebase.auth().signInWithCredential(provider).then(firebaseData =&gt; {
          this.af.database.list('users').update(firebaseData.uid, {
            name: firebaseData.displayName,
            email: firebaseData.email,
            provider: 'facebook',
            keys: firebaseData.keys,
            birthday: firebaseData.birthday,
            snapchat: firebaseData.snapchat,
            gender: firebaseData.gender,
            image: firebaseData.photoURL
          });
  
          observer.next();
        });
      }, error =&gt; {
        observer.error(error);
      });
    } else {
      this.af.auth.login({
        provider: AuthProviders.Facebook,
        method: AuthMethods.Popup,
      }).then((facebookData) =&gt; {
        console.log(facebookData);
        this.af.database.list('users').update(facebookData.auth.uid, {
          name: facebookData.auth.displayName,
          email: facebookData.auth.email,
          provider: 'facebook',
          keys: 5,
          birthday: 'w',
          snapchat: 'w',
          gender: 'male',
          image: facebookData.auth.photoURL
        });
        observer.next();
      }).catch((error) =&gt; {
        console.info("error", error);
        observer.error(error);
      });
    }
  });
  }
  </code></pre>