Hi,
for the mail fetching (I'm using m365) , I upgraded my osticket from v14 to v17. After I successfully did this, I added the plugin Oauth2.
After I followed your guild https://docs.osticket.com/en/latest/OAuth2/Microsoft%20Authorization%20Guide.html everything looks fine. I went to Emails -> select my email address -> filled remote mailbox and outgoing (SMTP)

remote mailbox
Mailbox Setting
Hostname
outlook.office365.com
Port Number
993
Mail Folder
INBOX
Protocol
Authentication
OAuth2 - Microsoft

outgoing (SMTP)
Hostname
smtp.office365.com
Port Number
587

When I now click on "config" to authenticate with OAuth2 - Microsoft, I get sent to the login and the permission request. After I accept it I get the following error.

I don't find the /api/auth/oauth2 on my system. Did I forgot something on my installation?

Regards

  • KevinTheJedi replied to this.
  • Extrude6990

    URL rewriting is not enabled on your webserver. You can search the older threads for a resolution or google "how to enable url rewriting on xxx" where "xxx" is your server OS (eg. Ubuntu, CentOS, IIS, etc.).

    Cheers.

    Extrude6990

    URL rewriting is not enabled on your webserver. You can search the older threads for a resolution or google "how to enable url rewriting on xxx" where "xxx" is your server OS (eg. Ubuntu, CentOS, IIS, etc.).

    Cheers.

    thank for you answer. I checked the rewirte_module and is is enabled (I'm using CentOS 7.9)

    Do you have another idea?

      sry, you were right. I change the wrong setting before. Now I have another problem. After I submit permission request, I get forwarded to my helpdesk homepage but the submit was not complete and has no impact.

      What do I wrong?

      Regards,

        Extrude6990

        If that's the case then rewriting is still not enabled correctly. It should redirect you back to the email page with a success message. There are older threads on here that explain how they got this working.

        Cheers.

        9 days later

        Hi KevinTheJedi
        I have the same problem...
        Allways this message : The requested URL /api/auth/oauth2 was not found on this server.

        Apache osticket conf :
        https://i.imgur.com/8wCO2Qs.png

        .htaccess in the folder api
        https://i.imgur.com/31dtaYi.png

        With webmin, i can see that the mod rewrite in enable
        https://i.imgur.com/dAHvY10.png

        Conf Oauth2 :
        https://i.imgur.com/eGy3BmQ.png

        I don't understand...
        do you have any technical advice for me?

          tsinfo88

          Your Resource Details Endpoint and Scopes are entirely incorrect. Please follow our documentation.

          If you have rewrite enabled that’s cool but do you have AllowOverride All setup in your Apache site config? Do you have any other config taking precedence over the .htaccess? You’ll just have to do some debugging on the server or some googling on how to properly enable URL rewriting for Apache.

          Cheers.

          6 days later

          thanks to you I have made progress in my configuration and I no longer have the same error.
          I have changed this like the documention (https://docs.osticket.com/en/latest/OAuth2/Microsoft%20Authorization%20Guide.html)

          https://i.imgur.com/ZHezMrj.png

          In the apache2 global conf : etc/apache2/apache2.conf i have changed AllowOverride none by AllowOverride All
          https://i.imgur.com/RsPbLLn.png

          Here’s my osticket conf
          https://i.imgur.com/w9juS6C.png

          Now when I send the auth2 configuration, the browser ask me to authenticate to microsoft 365 then I have this error :
          https://i.imgur.com/3o4BzUs.png

          My scope is like this :
          https://i.imgur.com/DnrSaTn.png

            tsinfo88

            That means you didn't add offline_access as an API Permission in the App Registration in Azure AD. You must also grant Admin Consent to all the API Permissions as well. Please go back and follow our documentation thoroughly.

            Cheers.

            Thanks KenvinTheJedi, I made a typing error: office_access instead of offline_access
            So now it's ok !

            2 months later

            Hi Everyone,

            I've worked with OSTicket Support and they suggested I ask in this forum. I'm having the same problem

            I've checked the .htaccess file and I have Rewrite and Override set. But still no luck. I've also installed a GUI on the CentOS 7 box that OSTicket lives on. Tested the OAuth directly from the server and still no luck.

            I enabled debug level logging for rewrite using the following:

            LogLevel alert rewrite:trace2

            Below is the logging message I received, but I'm not sure what to do to correct my issue. Can anyone help?

            Error_log
            [Fri Dec 30 13:39:44.765192 2022] [rewrite:trace1] [pid 206250] mod_rewrite.c(470): [client 10.240.19.213:51944] x.x.x.x - - [Y.Y.Y.Y/sid#556ca722e8a8][rid#556ca75035d0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/api/auth, referer: https://login.microsoftonline.com/
            [Fri Dec 30 13:57:43.899825 2022] [rewrite:trace1] [pid 207010] mod_rewrite.c(470): [client 127.0.0.1:55786] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca731f960/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/emails.php
            [Fri Dec 30 13:57:44.004601 2022] [rewrite:trace1] [pid 207010] mod_rewrite.c(470): [client 127.0.0.1:55786] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75035d0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/login.php
            [Fri Dec 30 13:57:44.215526 2022] [rewrite:trace1] [pid 206996] mod_rewrite.c(470): [client 127.0.0.1:55798] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74ff5b0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/logo.php, referer: https://localhost/osTicket/scp/login.php
            [Fri Dec 30 13:57:44.228605 2022] [rewrite:trace1] [pid 207209] mod_rewrite.c(470): [client 127.0.0.1:55802] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74fd5a0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/logo.php, referer: https://localhost/osTicket/scp/css/login.css
            [Fri Dec 30 13:57:53.584321 2022] [rewrite:trace1] [pid 207010] mod_rewrite.c(470): [client 127.0.0.1:55804] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca7311f60/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/login.php, referer: https://localhost/osTicket/scp/login.php
            [Fri Dec 30 13:57:53.729597 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55806] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/emails.php, referer: https://localhost/osTicket/scp/login.php
            [Fri Dec 30 13:57:53.983910 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55806] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74ff5b0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/logo.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:53.988137 2022] [rewrite:trace1] [pid 206670] mod_rewrite.c(470): [client 127.0.0.1:55808] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca755a380/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/autocron.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:54.146078 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55806] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74fb590/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/images/oscar-favicon-16x16.png, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:56.898967 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55806] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/images/tip_arrow.png, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:56.902903 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55806] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74fb590/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:57.486096 2022] [rewrite:trace1] [pid 207239] mod_rewrite.c(470): [client 127.0.0.1:55810] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74ff1b0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:57:57.620463 2022] [rewrite:trace1] [pid 206699] mod_rewrite.c(470): [client 127.0.0.1:55812] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca7558370/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:04.112410 2022] [rewrite:trace1] [pid 207209] mod_rewrite.c(470): [client 127.0.0.1:55828] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:21.112771 2022] [rewrite:trace1] [pid 207010] mod_rewrite.c(470): [client 127.0.0.1:55846] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:21.238845 2022] [rewrite:trace1] [pid 207196] mod_rewrite.c(470): [client 127.0.0.1:55848] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75035d0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:27.056258 2022] [rewrite:trace1] [pid 206840] mod_rewrite.c(470): [client 127.0.0.1:55852] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75055e0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:27.182384 2022] [rewrite:trace1] [pid 206670] mod_rewrite.c(470): [client 127.0.0.1:55854] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca7558370/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/emails.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:42.267115 2022] [rewrite:trace1] [pid 207239] mod_rewrite.c(470): [client Y.Y.Y.Y:38984] Y.Y.Y.Y - - [Y.Y.Y.Y/sid#556ca722e8a8][rid#556ca73146e0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/api/auth, referer: https://login.microsoftonline.com/
            [Fri Dec 30 13:58:50.887274 2022] [rewrite:trace1] [pid 206996] mod_rewrite.c(470): [client 127.0.0.1:55894] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/emails.php
            [Fri Dec 30 13:58:51.123663 2022] [rewrite:trace1] [pid 206996] mod_rewrite.c(470): [client 127.0.0.1:55894] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75561e0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/css/tooltip.css, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:54.070290 2022] [rewrite:trace1] [pid 206691] mod_rewrite.c(470): [client 127.0.0.1:55912] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca7311f60/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:54.201511 2022] [rewrite:trace1] [pid 206996] mod_rewrite.c(470): [client 127.0.0.1:55914] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74fd5a0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:58:56.180817 2022] [rewrite:trace1] [pid 206996] mod_rewrite.c(470): [client 127.0.0.1:55914] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75561e0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/images/icons/alert.png, referer: https://localhost/osTicket/scp/css/scp.css?1d8b790
            [Fri Dec 30 13:59:02.374930 2022] [rewrite:trace1] [pid 207344] mod_rewrite.c(470): [client 127.0.0.1:55916] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca74ff1b0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/ajax.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:59:02.529961 2022] [rewrite:trace1] [pid 206670] mod_rewrite.c(470): [client 127.0.0.1:55918] 127.0.0.1 - - [localhost/sid#556ca722e8a8][rid#556ca75015c0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/scp/emails.php, referer: https://localhost/osTicket/scp/emails.php?id=62
            [Fri Dec 30 13:59:10.804795 2022] [rewrite:trace1] [pid 206840] mod_rewrite.c(470): [client Y.Y.Y.Y:39022] Y.Y.Y.Y - - [Y.Y.Y.Y/sid#556ca722e8a8][rid#556ca74fd5a0/initial] [perdir /var/www/html/osTicket/] pass through /var/www/html/osTicket/api/auth, referer: https://login.microsoftonline.com/

              MattHaberer

              Sounds like you have other Apache configurations blocking rewriting for this site. The main thing is making sure you have AllowOverride All in the site config.

              You can google “how to enable url rewriting for Apache centos7” or “Apache url rewriting enabled but not working” for further information.

              Cheers.

              Hi Kevin,

              I have confirmed that AllowOverride All is set on all conf files. I've checked multiple articles and I went from having not found to Internal 500 Error.

              When I get this message in the GUI. I see this in the /var/log/httpd/error_log

              '[Fri Dec 30 16:08:10.016201 2022] [rewrite:trace1] [pid 215986] mod_rewrite.c(470): [client XXX- - [X.X.X.X/sid#564f86685f60][rid#564f869571e0/initial] pass through /osTicket/api/auth/oauth2, referer: https://login.microsoftonline.com/
              [Fri Dec 30 16:08:10.016673 2022] [core:alert] [pid 215986] [client x.x.x.x:41628] /var/www/html/osTicket/api/.htaccess: AllowOverride not allowed here, referer: https://login.microsoftonline.com/'

              any other ideas? I've insured AllowOverride All is in all config to the point that it broke OSTicket at first, but above is the closest I got. I also checked /var/log/messages but nothing helpful there.

              Thanks for any advice!

              Matt

                MattHaberer

                It’s saying AllowOverride is not allowed within the /var/www/html/osTicket/api/.htaccess file. So it seems like you edited the .htaccess files that osTicket ships with. You are not supposed to edit any of the osTicket files. Please restore these files to vanilla and retest.

                Cheers.

                a month later

                I had the same issue and couldn't get the apache2 URL Rewrite to work in Ubuntu . The thing that finally fixed it was enabling it in the main apache config, not just the site config.

                Steps:
                1) sudo nano /etc/apache2/apache2.conf
                2) Find

                <Directory /var/www/>
                        Options Indexes FollowSymLinks
                        AllowOverride None
                        Require all granted
                </Directory>

                3) replace AllowOverride None with AllowOverride All

                <Directory /var/www/>
                        Options Indexes FollowSymLinks
                        AllowOverride All
                        Require all granted
                </Directory>

                4) Restart apache
                sudo systemctl restart apache2

                System Specifics:

                osTicket Version 	1.17-git (?) — 8fbc7ee is available
                Web Server Software 	Apache/2.4.52 (Ubuntu)
                MySQL Version 	8.0.32
                PHP Version 	8.2.1
                2 months later

                Hi, I too am getting the error.
                However, in my case the directory / file don't actually exist on the server
                The plugin is enabled, and has been for some time.

                I get this after setting up the Auth:

                Should I remove and re-install the Plugin?
                Currently running Version 1.17.2
                Centos V7, using httpd that ships with Centos

                Is it possible I have missed a step somewhere during the Plugin install?