Search code examples
oauth-2.0exchangewebservices

Getting the username (at least user's email address), after obtaining the access token for EWS.AccessAsUser.All


We are getting an access token for scopes: 'https://outlook.office.com/EWS.AccessAsUser.All offline_access'.

Unfortunately, the response for 'https://login.microsoftonline.com/common/oauth2/v2.0/token' doesn't contain id_token or something like this.

So the question is how to get username (an email address or unique_name) using the access token.


Solution

  • Oh, I just had to add "openid email" to scopes to get id_token which contains email address.