For authentication, we are using below scopes as mentioned in the doc https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth
offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/SMTP.Send We are able to get access_token and refresh_token successfully
We want to get userPrincipalName but https://outlook.office.com/api/v2.0/me/ api doesn't return userPrincipalName. We tried using graph api https://graph.microsoft.com/v1.0/me to get userPrincipalName however we are getting error , looks like for hitting graph api only graph scopes would work.
We tried with graph scopes urls,
https://graph.microsoft.com/IMAP.AccessAsUser.All , https://graph.microsoft.com/SMTP.Send and able to hit graph api , however smtp and imap authentication is not working with these scopes.
since Microsoft is deprecating outlook rest apis and asking to move to graph api then why graph scopes urls are not supported for SMTP and IMAP ?
Is there any way we can get the userPricipalName ?
https://outlook.office.com/api/v2.0/me/
to get the information of the logged-in user, what error happened? – Carl Zhao