Hi, me too. I spend a tons of hour to tried… but yesterday a glimpse of light…
premise: i’m not a programmer or developer of dolibarr… so I think it’s better to involve these persons…
Some article and test and test and test and test could be solve the problem…
interesting documentation:
https://blog.icewolf.ch/archive/2022/12/17/exchange-online-pop-and-imap-oauth-2-0-client-credentials.aspx
https://blog.icewolf.ch/archive/2022/12/20/exchange-online-other-ways-of-testing-imap-oauth2-client-credential.aspx
Based on these articles now oauth works…
I share with you the code to test in the hope that the real developer try to fix the problem… I don’t know if it’s correct the workaround but it works…
/core/lib/oauth.lib.php line 35:
$supportedoauth2array['OAUTH_MICROSOFT_NAME'] = array('callbackfile' => 'microsoft', 'picto' => 'microsoft', 'urlforapp' => 'OAUTH_MICROSOFT_DESC', 'name'=>'Microsoft', 'urlforcredentials'=>'https://portal.azure.com/', 'availablescopes'=>'openid,offline_access,profile,email,User.Read,https://outlook.office.com/.default,https://outlook.office.com/.default', 'returnurl'=>'/core/modules/oauth/microsoft_oauthcallback.php');
/includes/OAuth/OAuth2/Service/Microsoft.php lines: 41 42
const SOCPE_IMAP_ACCESSASUSERALL = 'https://outlook.office.com/.default';
const SOCPE_SMTPSEND = 'https://outlook.office.com/.default';
I didn’t try to send an email… but the collector now works… sorry… but this is my personal fresh solution… I didn’t have time to try…
in the next days i’ll try