symoss Thanks for coming back to me. Much appreciated. I got it working using basic authentication but I'd much prefer to have all access working through Oauth2. Maybe I'll recreate it all when time allows.
MS OAuth2 Error: The API version 'V2' has been depreciated.
KevinTheJedi
Hey Kevin.
The code changes you did here worked fine, but we also had to apply the scope change of offline_access https://outlook.office.com/IMAP.AccessAsUser.All https://outlook.office.com/POP.AccessAsUser.All https://outlook.office.com/SMTP.Send
from jerer (https://forum.osticket.com/d/105728-ms-oauth2-error-the-api-version-v2-has-been-depreciated/12) to make it accept the scopes. With the combined changes, it seems to work as expected with MS365 accounts (business, not personal, addresses).
I will admit this seems like a hacky approach having the changes in the plugin and the scope changes, but otherwise it wouldn't send AND receive properly.
Of course, all of that was explained above in this thread. I even mentioned the scopes at some point as well.
Of course it “feels hacky” because you are modifying the code directly. The same changes will be included in the official build so nothing hacky about it. The scopes are actually recommended by ms themselves so nothing hacky about that either.
Cheers.
KevinTheJedi I apologize as I am trying to follow your solution. I run Powershell as an admin, run the CD command to the plugin directory and run the exact command, but I am not seeing the output. Is the oauth2.php file expected to be in the parent directory or should the command be creating a "auth-oauth2" directory and placing the file there? I am confident I can follow the rest of what you have outlined, but I am not seeing what I would gather to be the expected result from the "php -r" command.
The expected result is a new folder called the same thing as the plugin minus the extension. It creares an unpackaged version of the PHAR file with all files in it. So run the command and open the file within the new folder.
Cheers.
I'm stuck at the database edit. Where do I have to edit the path?
Nevermind I was able to solve it. Thanks a lot for the great help KevinTheJedi
KevinTheJedi "The same changes will be included in the official build". When will the official build be released? Thank you.
KevinTheJedi Thanks. I will have to look into why it is not creating the directory as expected.
KevinTheJedi Terribly sorry, I just can't get the .phar to extract to the new directory. Running PHP version 8.1.6, open elevated powershell, cd to the plugin directory and run the code as written. I have also tried running the lines separately and by using php -a to run the commands in an interactive shell. Still no dice.
I’m not sure then..I am no windows expert. I would research online for alternative ways. Some sites will unpack it for you although I don’t trust 3rd party sites.
Cheers.
KevinTheJedi I'll keep looking, thanks. Many sites just talk about packaging the phar archive, not much to go on for unpacking. When I figure it out, I will post for others.
KevinTheJedi As promised, I have figured out the issue and am posting for reference. For whatever reason, Powershell will NOT extract the phar. No errors, but nothing happens. I running the commands in the Command prompt, I got an error that "The filename, directory, or volume label syntax is incorrect". Finally, I stumbled upon the following post: https://stackoverflow.com/questions/12997385/extracting-files-from-phar-archive
In the top answer (matches your code verbatim) there is a comment about "Windows related quotes stuff" simply switching the ' in your code with the " to match: php -r "$phar = new Phar('auth-oauth2.phar'); $phar->extractTo('./auth-oauth2');"
got the job done. Ridiculous.
KevinTheJedi For some reason, using powershell i'm getting errors when trying to do this.
Do we have a long-term fix for this? Are there plans to update the plugin? Even if I could somehow get the extracted files just so I can get working.
Read the message right above yours..
And yes of course official build coming soon. Still working out aliases, etc.
Cheers.
KevinTheJedi Can confirm this worked for me.
Hi All, can anyone post the modified phar file? I am having a hell of a time trying extract the file.
The fix posted at 41 worked for me as well, custom domain non shared account.
Hey Kevin!
I was able to unpack the phar and edit the oauth.php, but in the web UI of osTicket, there is no Oauth option. Only basic authentication. I also updated the DB, but I'm doing something wrong! Any ideas to try from here? Is there an ETA on the release of the updated plugin? Thank you
chris-plahn Try their github. It's all extracted on there. Here's a link: https://github.com/osTicket/osTicket-plugins