So I'm essentially trying to connect, via IMAP, to Outlook/Exchange email accounts, using Node.
Using the old Live Connect API I'm able to do an IMAP AUTHENTICATE
command with the OAuth 2 token (https://msdn.microsoft.com/en-us/windows/desktop/dn440163). But this doesn't seem to work for Exchange accounts as attempting to do the Oauth flow with those just brings up an error "This Microsoft account doesn't exist."
Using the new Microsoft Identity Platform, I'm able to Oauth for the Exchange accounts just fine. But this brings up a totally different issue, where the tokens don't work for IMAP. I'm guessing I'm missing a scope here (I've added all the Mail scopes though), but there are no docs on this and I don't have a paid support plan with Microsoft.
When adding Exchange to Apple Mail, I see that it shows a different consent screen that asks for consent in a different manner. I believe Apple Mail also connects to Exchange via Oauth 2.0 mechanisms so I'm wondering how they go about it.
If anyone has experience with connecting via IMAP to Outlook or Exchange accounts I would be super grateful!