Hello KevinTheJedi, thank you for very much for coming back to me. Our ticketing system is almost working successfully with your fix. What we are experiencing at moment is that we constantly need to go admin panels, emails on the remote mailbox page we need to click on config and press save in order to refresh the token and download new ticket. Any reason why? It was done automatically before applying this fix.
To anyone experiencing issue with extracting the phar file on windows, instead of trying with the command line, go on unphar[dot]com/extract load the phar file and save the zip file in the plugin folder on OSTicket (wwwroot; OSTicket; include; plugin). Once the zip file is in there, extract it and from there open the folder and edit the oauth2.php file and follow the guide from Kevin.
Thanks again Kevin