title: Facebook and Firebase Authentication in Angular2
body: <p>I found some troubles with firebase and facebook authentication using Angular2. I´ve created this method to verify with the console if the user is logged in but I think this isn´t the correct way to do this because the console is not reporting me the correct values.</p>
  
  <p>So here is my code:</p>
  
  <pre><code>export class AppComponent {
    user: Observable&lt;firebase.User&gt;;
  
    constructor(private afAuth: AngularFireAuth, private db: AngularFireDatabase) {
    }
  
    ngOnInit() {
      this.user = this.afAuth.authState;
      if (this.user)
        console.log('NOT LOGGED');
      else
        console.log('LOGGED IN', this.afAuth.authState);
    }
  
    login() {
      this.afAuth.auth.signInWithPopup(new firebase.auth.FacebookAuthProvider())
        .then((res) =&gt; console.log(res));
    }
  
    logout() {
      this.afAuth.auth.signOut();
    }
  }
  </code></pre>
  
  <p>How can I use the user observable in a better way?</p>