I am trying to setup the OAUTH email settings for O365. My company uses O365 with MFA email so I need to have this authentication method working to utilize the email ticketing features. I have followed all Dolibarr guides and several outside guides for the Microsoft Entra sides of things. The problem I seem to have is some authentication issue. I have successfully been able to get a token but it shows me that my expiration is one hours on the token, even though in Entra it is set for 2 years. When doing the email test I get authentication errors as well. I am concerned my app ID and secret keys are being generated for my personal Microsoft account not the one I am trying to use to handle company emailing. We do not use AD or have a Domain but I did setup Azure/Entra to allow for this and we do have it working with our current CRM Connectwise Manage we are looking to change from. Any guides or help on the Microsoft side and Dolibarr side would be extremely appreciated as this is where I am stuck. Thank you all for any help! I am on the latest V19 at this time as well. I will provide as much screenshots and logs as I can find related to this.
I had the same issues as you and simply gave up… I got some help from @eldy but I never got it to work properly.
I do not understand how people can use Dolibarr without email integration, so I assume it is working for some users… maybe they use Google mail or something other than Microsoft accounts… Anyway, I hope this gets solved once for all because I would really like to use Dolibarr but I get defeated every time I try to set up the email… I retry every 3 months or so, hoping the developers have found a way around this…
Anyway, I hope you have some luck in your setup efforts!
Fortunately, a lot of users succeed in sending email using Microsoft OAuth and SMTP, like reading using IMAP.
There is no more work on Dolibarr side around this I know because when it does not work the problem seems on microsoft side only (the setup on Microsoft side is very complex for unknown reason and very bugged, it works for some, does not for other). But Microsoft does not provide any efficient support to help users to diagnose what’s wrong on their setup. It seems this is done on purpose, Microsoft don’t want external application to use their email SMTP service and prefer that you buy and use their own solution.
It is clear that using Gmail or any other sMTP provider that is not MS365 is 100% ok, when using MS365 has a lot of trouble on microsoft side, with no explanation provided by Microsoft.
When it works with MS365, it’s great, but if it does not, i’m afraid there is no real action we can do on our side to solve this…
Yes, 1 hour for expiration is the expected delay for expiration of a token when you retreive it. This should not be a problem because you should also get a “refresh key” with the token and this refresh key is used to refresh the token as soon as dolibarr need to use the token when it has expired. And the refresh key has no epiration delay.This means once you have a token, it should be possible to use it for several year.
Hi,
i am using Dolibarr since Version 19 with Office 365 Business Standard E5, of course it was not easy at the beginning, but with the help of this forum i got it working like a charme, especially for the ticket system.
No need for the developers to change something, my environment at the moment is as follows
20.0.3 on Ubuntu 20.04 with PHP 8.2.27 and nginx 1.27.0
Microsoft Oauth2
with acitvated PHP-IMAP instead of the native imap
my scopes are as follows
keep in mind the PHP Settings i needed to change some settings
Well… I have spent the whole day today, giving it one more chance…
I noticed that the docker image I used was tuxgasy/dolibarr:developer which showed as V21, and I had the same issues I always had… I get the tokens but when I use the email collector to collect emails then I get a http 500 error and Dolibarr seems to crash.
I downgraded to “latest” version which took me to 19.0.2, same story there…
I changed the image to dolibarr/dolibarr:latest which shows as version 20.0.3.
Long story short, the tokens are working now and the email collector also (!!!).
I do not want to hijack your topic, so I will leave my questions for the email collector at a different thread, I just wanted to inform you that I got mine to work (despite being useless since the extraction of information from the emails seem to be not straight forward…)