8
votes

I'm using an IMAP client in my program. I'm trying to access to Office 365 outlook by IMAP client using OAuth2 mechanism (using these instructions.)

When I authenticate in IMAP client - authentication failes, but OAuth2 authentication of Google and Outlook.com works fine. Does Office 365 support OAuth2 authentication in IMAP? If it does, how to authenticate?

4

4 Answers

9
votes

We are actively working on OAuth support for IMAP connections to O365 mailboxes. We will make a public announcement once the same is available.

1
votes

With the new rollout for OAuth 2.0 support for IMAP, I am able to generate the token using the scope

https://outlook.office365.com/IMAP.AccessAsUser.All

But I am still getting

A1 NO AUTHENTICATE failed

I am using the following properties:

props.put("mail.imap.ssl.enable", "true"); 
props.put("mail.imap.auth.mechanisms","XOAUTH2");
props.put("mail.imap.auth.plain.disable", "true");

EDIT: It is working now !

-1
votes

I got this to work as I described here: Connect to outlook Office 365 IMAP using OAUTH2

The App Permissions in Azure AD have been moved to the Graph API Section different to the screenshot that was in the comments above. Also the Scope that Azure AD shows did not work for me, I had to use https://outlook.office365.com/IMAP.AccessAsUser

-8
votes

We don't support OAuth for IMAP access to Office 365 and we have no plans to do so as we recommend using our REST APIs to connect to Office 365 for your apps. OAuth is supported for Office 365 REST APIs for mail, calendar and contacts and our older SOAP APIs Exchange Web Services.