Not able read outlook email messages using oauth2 accessToken

test16 1028 0 Reputation points
2023-07-18T13:03:17.42+00:00

i am trying to connect office 365 email by using oauth2 accessToken by using javax.mail library.
but was not able to connect to the Imap sever and read am getting always authentication failed exception.

Did the following steps:

  1. create app in AD.
  2. added following scope in it
    User's image

please help me out what exactly am doing wrong here.

Microsoft 365 and Office | Development | Other
Outlook | Windows | Classic Outlook for Windows | For business
Microsoft Security | Microsoft Graph
{count} votes

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.