Does test outlook email supports OAuth Token Based Authentication to read email message's.

test16 1028 0 Reputation points

am having a test outlook email which doesn't have any active subscription for Azure Active Directory.

I have registered my application. in Azure Active Directory and started reding the test email message in java code base using javax.mail library.

but what happening always am getting Authentication Failed exception does it needs the active subscription.

Code base am using.

Properties props = new Properties();
		props.put("mail.imaps.sasl.enable", "true");
		props.put("mail.imaps.sasl.mechanisms", "XOAUTH2");
		props.put("mail.imaps.sasl.mechanisms.oauth2.oauthToken", "accessToken");
		Session session = Session.getInstance(props);

		IMAPStore store = new IMAPStore(session, null);

try { 			
		store.connect("", 993, "AccessToken", ""); 			   				          	
} catch (MessagingException e) { 
			throw e; 		
Exception in thread "main" javax.mail.AuthenticationFailedException: AUTHENTICATE failed.
	at com.sun.mail.imap.IMAPStore.protocolConnect(
	at javax.mail.Service.connect(
	at javax.mail.Service.connect(
	at com.oauth.sample.ConnectOutEmailByPassingAccessToken.main(
A family of Microsoft email and calendar products.
2,623 questions
Outlook Management
Outlook Management
Outlook: A family of Microsoft email and calendar products.Management: The act or process of organizing, handling, directing or controlling something.
4,714 questions
0 comments No comments
{count} votes