Office365 OAUTH configuration issue

Helpdesk for my helpdesk software

Moderator: mkoch227

Post Reply
retech
Posts: 10
Joined: Tue Mar 28, 2023 12:52 pm

Office365 OAUTH configuration issue

Post by retech »

URL:
Version of script:
Hosting company: self-hosted
URL of phpinfo.php:
URL of session_test.php:
What terms did you try when SEARCHING for a solution:

Write your message below:

1st I am "really loving HESK", after many struggles with OS Ticket. This is such a better service desk application.

I followed these HESK instructions and configured Office365 OAUTH CLICK HERE

My office365 consists of the two accounts:
  • My main email account john_(at)_my_domain.com
    • This account is on an Exchange Online(Plan1)
  • My second office365 acct is my service desk account: service desk email acct servicedesk_(at)_my_domain.com
    • this account is on an Exchange Kiosk account
  1. When I configure OAUTH and test SMTP, it is successful.
  • When I configure and test POP3 with OAUTH and my service desk account, the test fails
  • When I configure and test OAUTH with my mail email account it is successful
I am sure this is an office365 setting but for the life of me, I cannot figure out why it's failing. I have even verified that the account has SMTP and POP3 access configured for access https://prnt.sc/XWVCLa-1ycCo

This is the error message I get when I attempt to use my Office365 Kiosk account to retrieve POP3 mail

Code: Select all

Connecting to outlook.office365.com ...
S +OK The Microsoft Exchange POP3 service is ready. [QgBMADAAUABSADAAMgBDAEEAMAAxADQAMAAuAG4AYQBtAHAAcgBkADAAMgAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
C USER servicedesk@my_domain.com
S +OK
C PASS This_!z_kN0t_mY_P@ssW0Rd
S -ERR Logon failure: unknown user name or bad password.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Office365 OAUTH configuration issue

Post by Klemen »

Glad to hear you like Hesk so far.

For POP3, you are using Oauth and not basic authentication, right (article)?
POP3 Host: outlook.office365.com
POP3 Port: 995
TLS Protocol: ON
Authentication method: OAuth
IMAP Username: (your Office365 username)
OAuth Provider: select the OAuth Provider you have set up for Microsoft
Not sure if it will make a difference, but can you:
1. remove the OAuth provider
2. enable IMAP at Microsoft 365
3. open a PRIVATE (incognito) browser window
4. login to Hesk again and set up the OAuth provider again in the private window
5. when setting up OAuth and you are redirected to Microsoft365 to login, make sure you login with your service desk email acct
6. when OAuth is saved, test an IMAP connection instead
IMAP Host: outlook.office365.com
IMAP Port: 993
Encryption: SSL
Authentication method: OAuth
IMAP Username: (your Office365 username)
OAuth Provider: select the OAuth Provider you have set up for Microsoft
Any luck?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
retech
Posts: 10
Joined: Tue Mar 28, 2023 12:52 pm

Re: Office365 OAUTH configuration issue

Post by retech »

I am trying both OAUTH AND basic auth(username and password)

Here is what works:
  • user acct john@my_domain.com
    • This acct work for both SMTP, and POP3 retrieval using OAUTH or basic authentication
    • This account is set up on the Exchange Online Plan 1

Here is what doesn't work:
  • user acct servicedesk@my_domain.com
    • This acct works for SMTP
    • POP3 retrieval using OAUTH or basic authentication
    • This account is set up on the Exchange Online Kiosk Plan
Below is the OAUTH error message:

Code: Select all

Connecting to outlook.office365.com ...
S +OK The Microsoft Exchange POP3 service is ready. [TQBOADIAUABSADAAOABDAEEAMAAwADEANQAuAG4AYQBtAHAAcgBkADAAOAAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
C AUTH XOAUTH2
S + 
C dXNlcj1zZXJ2aWNlZGVza0Bub3JyY29tbXNvbHV0aW9ucy5uZXQBYXV0aD1CZWFyZXIgZXlKMGVYQWlPaUpLVjFRaUxDSnViMjVqWlNJNklsOHlZVmRFWmtVNVVXWTBaWHBEUkhOa1ZqZG5lVEo1ZDBocFNDMVBRM3BsTFZOTmEzUmlNMVZsY0hNaUxDSmhiR2NpT2lKU1V6STFOaUlzSW5nMWRDSTZJaTFMU1ROUk9XNU9VamRpVW05bWVHMWxXbTlZY1dKSVdrZGxkeUlzSW10cFpDSTZJaTFMU1ROUk9XNU9VamRpVW05bWVHMWxXbTlZY1dKSVdrZGxkeUo5LmV5SmhkV1FpT2lKb2RIUndj........
S -ERR Authentication failure: unknown user name or bad password.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Office365 OAUTH configuration issue

Post by Klemen »

I am not sure how basic authentication would work with any POP3/IMAP as it has been disabled by Microsoft (only SMTP still supports basic).

Also, what is a "Kiosk plan"? Not familiar with those. Do they have a different admin panel, or is everything managed the same way as regular Microsoft 365 accounts are?

When you were setting up OAuth in Hesk (in a private window) and was redirected to Microsoft to login, did you login using "servicedesk@my_domain.com"?
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
retech
Posts: 10
Joined: Tue Mar 28, 2023 12:52 pm

Re: Office365 OAUTH configuration issue

Post by retech »

I am not sure how basic authentication would work with any POP3/IMAP as it has been disabled by Microsoft (only SMTP still supports basic).
Good point...I'll review my OAUTH setup
Also, what is a "Kiosk plan"? Not familiar with those. Do they have a different admin panel, or is everything managed the same way as regular Microsoft 365 accounts are?
Here is a list of the available office365 email plans as the kiosk is the most basic of plans. https://lazyadmin.nl/office-365/exchang ... k-details/
When you were setting up OAuth in Hesk (in a private window) and was redirected to Microsoft to login, did you login using "servicedesk@my_domain.com"?
I don't remember being prompted for a user and account. I will run through the setup once more and verify.
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Office365 OAUTH configuration issue

Post by Klemen »

retech wrote: Thu Mar 30, 2023 5:47 pm I don't remember being prompted for a user and account. I will run through the setup once more and verify.
That may be the issue; you are logged into an account and adding the OAuth provider completes automatically for that account.

That's why I am recommending that you complete adding a new OAuth provider in Hesk in a private (incognito) browser window. This will make sure you are not logged in anywhere and will be prompted to login to Microsoft 365 at which point you should login with the servicedesk account.
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
retech
Posts: 10
Joined: Tue Mar 28, 2023 12:52 pm

!!SOLVED!! Re: Office365 OAUTH configuration issue

Post by retech »

That may be the issue; you are logged into an account and adding the OAuth provider completes automatically for that account.
Thanks for getting me back on the right path :D

That was the issue...my browser had cached my other acct credentials even though I was logged out(DOH!!!)

Now I'm off to purchase the licensed version...Cheers
Klemen
Site Admin
Posts: 10142
Joined: Fri Feb 11, 2005 4:04 pm

Re: Office365 OAUTH configuration issue

Post by Klemen »

Glad to hear that worked!
Klemen, creator of HESK and PHPJunkyardWas this helpful? You can buy me a drink here Image

Image You should follow me on Twitter here

Help desk software | Cloud help desk | Guestbook | Link manager | Click counter | more PHP Scripts ...

Also browse for php hosting companies, read php books, find php resources and use webmaster tools
Post Reply