How to Setup SMTP and IMAP email accounts via OAuth 2.0 Authentication on ServiceNow using MS O365

How to Setup SMTP and IMAP email accounts via OAuth 2.0 Authentication on ServiceNow using MS O365

We recently completed a task to setup SMTP and IMAP email accounts via OAuth 2.0 authentication on ServiceNow using MS O365. We also got this article published in ServiceNow community section. We are sharing the steps we followed to accomplish this task:


Steps:

1. Install Plugin - Email - OAuth support for IMAP and SMTP

2. Contact the O365 Admin and have him perform the below :

a. Register OAuth Authentication.

b. Create Certificates and Permission on the Mailbox to generate Application ID, Client secret ID and Client ID and Value (all these will be provided by the admin).

c. Create a API scopes on MS graph

3. Configure OAuth entity(application Registry) on ServiceNow

map details shared :

Client ID == Application ID

Client Secret == Value

Authorization URL:?https://login.microsoftonline.com/[Azure?Tenant ID]/oauth2/v2.0/authorize

Token URL:?https://login.microsoftonline.com/[Azure?Tenant ID]/oauth2/v2.0/token

Redirect URL: {Instance_URL}/oauth_redirect.do

No alt text provided for this image

4. Create OAuth Entity Profile Scopes as below and map the OAuth Entity.

No alt text provided for this image

a.?OAuth scope: "https://outlook.office.com/IMAP.AccessAsUser.All"

b.?OAuth scope: "https://outlook.office.com/SMTP.Send"

c.?OAuth scope: "offline access".

5. This should create OAuth Entity Profile, make sure OAuth Entity profiles also have the above scope mapped.

No alt text provided for this image

6. Create Email accounts Selection type as SMTP <> user connection security as STARTTLS (this is for email sending)

No alt text provided for this image

7. Create email accounts Selection type as IMAP <> connection security as SSL/TLS ( this is for receiving ).


No alt text provided for this image

8. Before clicking on "Authorize Email account access", please open a browser in incognito mode and then apply. This should open a MS SSO window where you enter credentials of the mailbox you are trying to authorize.

Note : Failing to do so or if your authentication passes without an MS SSO window, please understand that your account has been validated instead of the mailbox.

9. Once your mailbox account is validated with MS, your tokens will be refreshed.

10. In case of any errors you can grant permissions to mailbox, validate email diagnostics and check if sender and reader jobs are properly running.

Note: Regarding SMTP : Once configured, you will have to use your mailbox when authorizing the access, better to use incognito mode. This will allow the you to enter the mailbox credentials and create authentication.

?

For IMAP: You can follow the above, and also check if the mailbox has IMAP scope set up, get the O365 admin to validate and enable the IMAP scope, this should fix receiving issues as the Email reader will start reading emails from your Mailbox.


We do have a KB article #KB0816072 for reference, however it does not provide clear details on how to set up correctly.

要查看或添加评论,请登录

Prometheas Technologies - Software Development Company的更多文章

社区洞察

其他会员也浏览了