Forum Discussion
Cannot connect to IMAP and SMTP using OAuth2.0 to Exchange Online
- May 17, 2020
A quote of the Stack Overflow reply from:
IMAP, SMTP scopes are targeted for Exchange resource and not Graph. Whereas User.Read, Mail.ReadWrite are meant for Graph resource.
We do not support generation of tokens that are meant for two resources. Hence the error "Provided value for the input parameter scope is not valid because it contains more than one resource."
You should generate two tokens separately by two calls to /token. 1. One with the IMAP, SMTP scopes generated for the Exchange resource. 2. The other with Graph scopes (User.Read, Mail.ReadWrite) meant for Graph resource.
https://stackoverflow.com/a/61678485/1126831
ledniov Even Microsoft support team says that they have removed scopes
https://outlook.office365.com/IMAP.AccessAsUser.All
https://outlook.office365.com/SMTP.Send
They are recommending to use Graph permission/scopes.
Is your application still able to connect using Graph scopes
The correct scope is "offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send"
Also, I've seen it fail if you are trying to use a secondary alias. Make it primary by going to "Manage how you sign in to Microsoft" in your Microsoft account settings at https://account.live.com