0

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!

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
cuuupid
  • 912
  • 5
  • 20

1 Answers1

2

Office 365 IMAP4 and POP3 OAuth support has not been enabled yet. It will be enabled some time before October 2020, when Basic auth will go away for all protocols except SMTP.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • 1
    Also see https://stackoverflow.com/questions/29747477/imap-auth-in-office-365-using-oauth2 – Dmitry Streblechenko Oct 30 '19 at 20:50
  • In this case, what is the recommended "secure approach" to go about IMAP/SMTP? Does "Basic Auth" refer to username/password authentication into the IMAP server? If so, what is the approach that Apple Mail uses where the login is done through the pop-up window without storing the password? – cuuupid Oct 31 '19 at 16:24
  • Yes, Basic authentication is plain old username/password. That is what Apple Mail and Outlook use for all POP3 and IMAP4 accounts as of today. – Dmitry Streblechenko Oct 31 '19 at 18:05
  • is it enabled yet? @DmitryStreblechenko – Rodger Oct 12 '20 at 20:52
  • Yes - https://techcommunity.microsoft.com/t5/exchange-team-blog/basic-authentication-and-exchange-online-july-update/ba-p/1530163 – Dmitry Streblechenko Oct 12 '20 at 21:40