IMAP error: User is authenticated but not connected?

Gaurav Baranwal 6 Reputation points

Hi Team,

I am encountering a problem while performing mail operations such as move message or retrieve message for more than 20 requests. error which i am receiving is: "User is connected but not authenticated.".

followed all instructions mentioned at :


I tried with both imap host (, but that didn't help.

below IMAP settings used:

please can someone help here, how to use imap with oauth2 using javax mail api.

prop.setProperty("", imaps);
prop.put("mail.imap.ssl.enable", "true");
prop.put("mail.imaps.sasl.enable", "true");
prop.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
prop.put("mail.imap.auth.login.disable", "true");
prop.put("mail.imap.auth.plain.disable", "true");
prop.put("mail.imap.port", "993");		
Microsoft Exchange Online
A family of Microsoft email and calendar products.
1,816 questions
Exchange Server Development
Exchange Server Development
Exchange Server: A family of Microsoft client/server messaging and collaboration software.Development: The process of researching, productizing, and refining new or existing technologies.
444 questions
0 comments No comments
{count} votes