title: Angularfire2 Authentication: How to get the current user?
body: <p>In my angular-app I am using angularfire2 Authentication.
  When opening a certain window, I want to get the email of the current user.</p>
  
  <p>To this end, I wrote the following code:</p>
  
  <pre><code>ngOnInit() {
  
      this.currentUserEmail = this.angularFireAuth.authState
        .switchMap(user =&gt; {
            console.log("this is a test");
            return user.email;
        });
  
  }
  </code></pre>
  
  <p>The code follows the documentation here:
  <a href="https://angularfirebase.com/lessons/google-user-auth-with-firestore-custom-data/#Step-3-Auth-Service" rel="nofollow noreferrer">https://angularfirebase.com/lessons/google-user-auth-with-firestore-custom-data/#Step-3-Auth-Service</a></p>
  
  <p>However, for some reason, the part after "switchMap" is never entered".
  So the line "this is a test" gets never printed.</p>
  
  <p>How can I get the current user (and his/her email)?</p>