IMAP auth in Office 365 using OAuth2

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


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 !