I was also concerned by the problem but I've just fixed it.:
I was redirected to "404 Not Found" at the end of the Microsoft 365 Authentication process and not getting the token back into osTicket. It was on a freshly installed Apache2 server with no other config except the default + my vhost for osTicket.
The problem was indeed coming from the rewriting rules in the api/.htaccess file that were getting ignored.
I've just fixed the problem by doing two things:
- checking that the rewriteModule is enabled by using a2enmod rewrite command (it was actually already OK in my case).
- adding the following AllowOverride directive in my vhost configuration
<Directory /var/www/support.mycompany.com/api>
AllowOverride FileInfo
</Directory>
Please adjust the path to your context.
Please note that the value "All" is not required. "FileInfo" is enought for the RewriteEngine according to apache2 documentation.