title: Microsoft Azure AD graph API: How do I retrieve a user's email address?
body: <p>I am able to get access to a user's accessToken, and am making a call to <code>GET https://graph.microsoft.com/v1.0/me</code> with an <code>Authorization: Bearer &lt;token&gt;</code> header.</p>
  
  <p>However, in the response body I'm getting something like this:</p>
  
  <pre class="lang-json prettyprint-override"><code>{
      "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
      "value": [
          {
              "givenName": "Foo",
              "surname": "Bar",
              "displayName": "Foo Bar",
              "id": "b41efha115adcca29",
              "userPrincipalName": "email.address@outlook.com",
              "businessPhones": [],
              "jobTitle": null,
              "mail": null,
              "mobilePhone": null,
              "officeLocation": null,
              "preferredLanguage": null
          }
      ]
  }
  </code></pre>
  
  <p>The <code>mail</code> property is <code>null</code>, and the <code>userPrincipalName</code> in this response body happens to the be the user's email address. However, there's this from Microsoft's <a href="https://docs.microsoft.com/en-us/azure/active-directory/connect/active-directory-aadconnect-user-signin#user-sign-in-and-user-principal-name" rel="noreferrer">docs</a>:</p>
  
  <blockquote>
    <p>Although the UPN and email share the same format, the value of the UPN for a user might or might not be the same as the email address of the user.</p>
  </blockquote>
  
  <p>When initiating the login request of the user, we're requesting for the <code>"user.read"</code> and <code>"email"</code> scopes. We're using the <a href="https://github.com/AzureAD/microsoft-authentication-library-for-js" rel="noreferrer">MSAL.js</a> library to obtain the access token, and our code reads something like this:</p>
  
  <pre class="lang-ts prettyprint-override"><code>login (): ng.IPromise&lt;IMicrosoftOAuthResponse&gt; {
    const prom = this.userAgentApplication.loginPopup(["user.read", "email"])
      .then((idToken) =&gt; {
        return this.userAgentApplication.acquireTokenSilent(["user.read", "email"]);
      })
      .then((accessToken) =&gt; {
        // at this point, we have the accessToken and make a call to the graph api
      });
    return this.$q.when(prom);
  }
  </code></pre>
  
  <p>How do I get the actual email address of the user here?</p>