title: Amplify w/Cognito: How do I get the Current User's Email?
body: <p>I am using AWS Amplify, with Cognito for user Auth.</p>
  
  <p>Users go into a user pool, and register and sign in just with email address and password.</p>
  
  <p>When a user that has signed in through Cognito navigates to a certain page, I want to be retrieve their email address. How can I do this?</p>
  
  <p>I am able to retrieve some user data with this code (I am using javascript/Angular):</p>
  
  <pre><code>import Auth from '@aws-amplify/auth';
  ...
  
  ngOnInit(){
    Auth.currentAuthenticatedUser().then((user)=&gt;{
          console.log('user = ' + JSON.stringify(user.pool))      
   })
  }
  </code></pre>
  
  <p>The email does appear on the response, but I haven't yet been able to isolate the email from the returned JSON. </p>
  
  <p>I've tried going through the docs, but I haven't yet found info on stuff like the attribute options I can add to <code>currentAuthenticatedUser()</code>, or if there is another method that is cleaner (which I assume there is).</p>
  
  <p><strong>EDIT: It looks like the following works:</strong></p>
  
  <pre><code>Auth.currentAuthenticatedUser().then((user) =&gt; {
    console.log('user email = ' + user.attributes.email);
  });
  </code></pre>
  
  <p>But I am still hoping to understand the documentation better. I found this solution in a random github question, not the official docs. Where would I find this solution in the AWS Amplify / Cognito documentation?</p>