Microsoft Graph, Outlook, OAuth2, Resources, Audiences…

Here I’m just relaying bits of knowledge from a great Chilkat customer…

“I learned meanwhile that Microsoft doesn’t like mixing “resources”, so if you request something from “Graph” resource and “Outlook” resource, they are incompatible resources, so you have to request different tokens for both, or request resource for only Graph and then refresh token only for “Outlook” resources – it is described here:

https://stackoverflow.com/questions/48579143/one-or-more-scopes-are-not-compatible-with-each-other-error-when-retrieving-ac

I was successful in requesting Graph only resources:
openid
profile
email
offline_access
User.Read
IMAP.AccessAsUser.All
POP.AccessAsUser.All
SMTP.Send

 

The “User.Read” line is crucial for reading user data (“me”) (after adding it – it works), but then it doesn’t work when using token on IMAP/POP/SMTP (it would probably work if using Graph API, but IMAP/POP/SMTP are “Outlook” API. And you can’t get a same token as then it issues an error if you include https://outlook.office.com/ before as then again it mixing “resources”. Whatever. It is a complete mess.”