Hi all,
I've been searching for all the simmilar issues like mine in this forum, trying to apply a solution for my problem but I had no luck. Now I'm facing a really tight deadline and I need to have this working asap, I'll give all the info i'm able to, so hopefully anyone can give me some light because I don't know what else to do.
I'm using osticket 1.17.3 , fresh installation. My OS is debian 11 and I am using apache2 as the webserver.
Osticket is working good so far, but now I need to configure the oauth2 plugin so I can use the office365 emails, I've followed the userguide for this topic, and with the help of an azure admin, I got the information about the endpoint urls, secret, and so on...

Once I click on submit in the config page, it redirects me to the office login page, I log in successfully, but when I have to ask for the permission, a link that says "go back to the application" appears and when I click on it, it takes me to the main page of my osticket (https://10.56.27.193/osticket/)

I've read a lot of simmilar topics saying that this is that I don't have rewriting enabled in my webserver, but I've already enabled it:

I've checked with the browser console that the url that the server is triying to go to is:
https://10.56.27.193/osticket/api/auth/oauth2?error=access_denied&error_subcode=cancel&state=1174d5b22438a35c91234744367edb43&error_description=AADSTS65004%3a+User+declined+to+consent+to+access+the+app."
So looking at the URL it looks like there's an error with the consent to access the app, but it should to go to the /osticket/scp/emails.php page as I seen in other topics, not to the osticket mainpage.
The .htaccess file is in /var/www/osticket/api/ and the rights are OK.
I also did some manual redirections in the apache2 config file, like this ones, but no one worked (some of them got me a error 500 page):
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .*$ /osticket/api/http.php [L,QSA]
or
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/osticket/api/auth/oauth2 [NC]
RewriteRule ^/(.*)$ /osticket/api/http.php [L,QSA]
I hope anyone can help me.
Thank you all
edit:
This is my apache2 config:
<VirtualHost *:443>
ServerAdmin admin@example.com
DocumentRoot /var/www/html/
<Directory /var/www/html/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
SSLEngine on
SSLCertificateFile /etc/ssl/certs/apache-selfsigned.crt
SSLCertificateKeyFile /etc/ssl/private/apache-selfsigned.key
</VirtualHost>
edit2: Azure admin says that he has approved my request to connect to the application but I am still not able to configure the email
edit3: without touching anything it worked... I don't know if it was some kind of delay with the authorization with azure, but now I'm getting another error when fetching emails.