php-imap2 icon indicating copy to clipboard operation
php-imap2 copied to clipboard

Issue connecting to IMAP

Open Black-Dragon-Spirit opened this issue 2 years ago • 1 comments

When using an application token (without user) it's not possible to connect (authenticate) to the server. Tried dividend scopes for the token: https://graph.microsoft.com/.default https://outlook.office.com/.default https://outlook.office365.com/.default

All the permissions are set.

Black-Dragon-Spirit avatar Aug 22 '23 13:08 Black-Dragon-Spirit

@Black-Dragon-Spirit When using an application token you are authenticating to Azure, NOT the mailbox (or you could read any of them in a corporate 365 environment). The error is correct, but a bit misleading. You have to use the Enterprise application and use a service principle to authorise delegate access to the mailbox(es) as if you would granting Bob access to Alice's mailbox when Alice goes on vacation. https://outlook.office365.com/.default is the correct scope to use.

https://vielhuber.de/en/blog/access-with-php-to-exchange-office-365/ https://www.limilabs.com/blog/oauth2-client-credential-flow-office365-exchange-imap-pop3-smtp

tiamatloc avatar Aug 22 '23 14:08 tiamatloc