Mail monitor service using javamail and outlook365 with IMAP

Welton, Craig 1 Reputation point

We have an existing standalone java application that periodically connects to and monitors email accounts in outlook365. It is currently using BASIC authentication with IMAP and works great. I have been asked to change to MODERN authentication. With no Azure AD experience I've been researching and trying to understand what the proper flow is from an app with no browser or interactive capability (a service). I created an application in azure and setup the security grants, but I'm not understanding the proper sequence of calls and parameters to get the access token for OAUTH2. Any help would be greatly appreciated.


Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,309 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. ChristyZhang-MSFT 20,616 Reputation points Microsoft Vendor

    Hi @Welton, Craig ,

    According to your description, the issue may related to Authentication flows and OAuth 2.0. Based on my research, it's suggested to follow these articles to check if it could work for you:
    Authentication flows
    Authentication flows and application scenarios
    OAuth 2.0 and OpenID Connect protocols on the Microsoft identity platform

    If that's invalid, please kindly understand that the Outlook tag here we mainly focus on general issues about Outlook desktop client and know little about Authentication flows and OAuth 2.0. In order to better solve your problem, we will remove "Office Outlook ITpro" tag, and add "azure-ad-authentication-protocols" tag.

    Thanks for your understanding and hope your question will be resolved soon.

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.