How to get the authenticated user's email address in node.js AWS Lambda?
<p>I have an Angular app that uses the AWS javascript SDK, and can successfully login with Facebook and Google.  I am able to create the Cognito identity and I see the identity in my Federated Identity pool.  I am also able to use my IAM authenticated API endpoints (I see the user's cognitoId in the Lambda I am calling).</p>

<p>I want to use the user's email address as the key in the database (DynamoDB), so I am trying to figure out how to access the user's email address from a trusted source, either Cognito (preferred) or the Authentication Provider's JWT.</p>

<p>What is the best way to access the user's email address?</p>

<p><strong>Update:</strong> On the client side (javascript) I'm using Federated Identities with Google and Facebook tokens.  The social login is working, and I can get authenticated with Cognito just fine, passing the Logins:</p>

<pre><code>AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'us-east-1:****',
    Logins: {
      'accounts.google.com': authResult['id_token']
    }
});
</code></pre>

<p>I then do <code>AWS.config.credentials.get()</code> and I can get things like <code>AWS.config.credentials.identityId</code>, but I can't find accessToken or the methods to call to get the JWT.  I believe I need to call <code>result.getAccessToken().getJwtToken()</code>, but I can't find it.</p>

<p>All of the examples where they get the accessToken seem to use <code>.authenticateUser(authenticationDetails())</code>, but the details include a user name and password (not Federated login).</p>