How to create a OAUTH2 App to access Exchange Accounts by IMAP, without Business account

Stefan Warnat 0 Reputation points
2023-07-24T12:30:53.8533333+00:00

Hy,

We currently do not have a Outlook 365 Business Account, but got request from customer to implement a function into our software, which should fetch mails from outlook 365 exchange mailbox.

We tried everything, but are not able to add the required permissions to our app, because the "API's our organization use" within APP Permission assistent is not shown. (of course, because we do not have an organization)

When I understand correctly, I need that permission to get Access Token work with XOAUTH2.

I can only add "*https://graph.microsoft.com/IMAP.AccessAsUser.All*" in relation to IMAP (and "email", "profile", "openid", "offline_access" of course) And OAuth2 Process is completed sucessfully with this.

But this is a part of Graph API. When I understand https://learn.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth correcly I need

either the Permission "https://outlook.office.com/IMAP.AccessAsUser.All*" or "https://ps.outlook.com/IMAP.AccessAsApp*" (I think the last one comes from older version of API)

But because I cannot add this permission in app configuration, I cannot request them within OAuth2 Process as Scope.

Until now I tried almost everything and almost 20 explanations, but nothing works.

So my question would be: Is it possible as personal account to create an APP, which an organization can add to access IMAP mailbox?

Everything around OAuth2 is known and understand. The personal account and access to other information over Graph API is not a problem.

Many Thanks!

Best Regards,

Stefan

Additional information:

We are using "thenetworg/oauth2-azure" for OAuth2 Process and php-imap2 for IMAP access. But OAuth2 Process is completely working and correct.

Microsoft 365
Microsoft 365
Formerly Office 365, is a line of subscription services offered by Microsoft which adds to and includes the Microsoft Office product line.
3,327 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.
491 questions
{count} votes