HTTP Error 401 - Unauthorized when authorizing email account access

Daniel R2
Kilo Sage

Hi,

On my current project, we are attempting to Configure SMTP and IMAP email accounts with Microsoft Office365 using OAuth2. The configuration on Azure side looks good and the configuration of the application registry and email account in servienow also looks good.

However, when we then select the "Authorize Email Account Access" (in an incognito window) on the IMAP email account, we were then prompted with the MS SSO where we entered the credential of the email account we want to authorize. However, it only directed me to a screen, which prompted an error "HTTP Error 401 - Unauthorized"

DanielRyszka_0-1671789497985.png

However, when I pressed back it brought me back to the IMAP email account in ServiceNow, this time without the option to select "Authorize Email Account Access" and when i tested the connection it was successful! it also mentioned an info message that said "OAuth Refresh token is available and will expire at 01-Apr-2023 16:55:38."

Can somebody please provide their support here in regards to the HTTP error, i presume we are not supposed to have seen this error when authorizing?

1 REPLY 1

Vasantharajan N
Giga Sage
Giga Sage

The issue is about the response parsing script include. Please refer to the post which already talks about the same issue and how you can fix it.

https://www.servicenow.com/community/developer-forum/get-oauth-token-gives-http-error-401-unauthoriz...

 

https://www.linkedin.com/pulse/servicenow-outbound-web-services-oauth-20-how-handle-r%C3%A9da-osseil...


Thanks & Regards,
Vasanth