IMAP with Oauth error AUTHENTICATE failedIssue You followed the below KB to configure MS 0365 IMAP account on the instance: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0816072 But still unable to do the test connection. Getting below error. ****** 2021-06-09 08:13:23 (213) Finalizer SYSTEM DEBUG: IMAP: IMAPStore cleanup, not connected[app111111.abc101:/glide/nodes/instance/logs]$ cat localhost_log.2021-06-09.txt | grep d58d1e4b1be02021-06-09 08:13:17 (589) worker.1 worker.1 txid=d58d1e4b1be0 *** Start Background transaction - system, user: system2021-06-09 08:13:17 (589) worker.4 worker.4 txid=d58d1e4b1be0 *** Start Background transaction - system, user: system2021-06-09 08:13:17 (591) worker.1 worker.1 txid=d58d1e4b1be0 Starting: Email Reader.91616b03c611227b014e3d95b7f9d1dd, Trigger Type: Interval, Priority: 25, Upgrade Safe: true, Repeat: 2 minutos2021-06-09 08:13:17 (591) worker.4 worker.4 txid=d58d1e4b1be0 Starting: communities fanout queue event process.a9ae77460f120010e6d4fd820b767e94, Trigger Type: Interval, Priority: 50, Upgrade Safe: false, Repeat: 1 Segundo2021-06-09 08:13:17 (591) worker.1 worker.1 txid=d58d1e4b1be0 Name: Email Reader2021-06-09 08:13:17 (591) worker.4 worker.4 txid=d58d1e4b1be0 Name: communities fanout queue event process2021-06-09 08:13:17 (599) worker.4 worker.4 txid=d58d1e4b1be0 Completed: communities fanout queue event process in 0:00:00.005, next occurrence is 09/06/2021 17:13:182021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: getProvider() returning javax.mail.Provider[STORE,imap,com.sun.mail.imap.IMAPStore,Oracle]2021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: mail.imap.fetchsize: 5242882021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: mail.imap.ignorebodystructuresize: false2021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: mail.imap.statuscachetimeout: 10002021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: mail.imap.appendbuffersize: -12021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: mail.imap.minidletime: 102021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: enable SASL2021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL mechanisms allowed: XOAUTH22021-06-09 08:13:17 (819) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: closeFoldersOnStoreFailure2021-06-09 08:13:17 (820) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: trying to connect to host "outlook.office365.com", port 993, isSSL true2021-06-09 08:13:18 (004) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: * OK The Microsoft Exchange IMAP4 service is ready. [ABC]2021-06-09 08:13:18 (004) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: BEI0 CAPABILITY2021-06-09 08:13:18 (026) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+2021-06-09 08:13:18 (026) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: BEI0 OK CAPABILITY completed.2021-06-09 08:13:18 (026) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: AUTH: PLAIN2021-06-09 08:13:18 (026) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: AUTH: XOAUTH22021-06-09 08:13:18 (027) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: protocolConnect login, host=outlook.office365.com, user=test@test.com, password=<non-null>2021-06-09 08:13:18 (027) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL authentication command trace suppressed2021-06-09 08:13:18 (027) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL Mechanisms:2021-06-09 08:13:18 (027) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: XOAUTH22021-06-09 08:13:18 (027) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP:2021-06-09 08:13:18 (028) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL client XOAUTH22021-06-09 08:13:18 (028) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL callback length: 12021-06-09 08:13:18 (028) worker.1 worker.1 txid=d58d1e4b1be0 DEBUG: IMAP: SASL callback 0: javax.security.auth.callback.NameCallback@986a082021-06-09 08:13:18 (725) worker.1 worker.1 txid=d58d1e4b1be0 AUTHENTICATE failed.2021-06-09 08:13:18 (729) worker.1 worker.1 txid=d58d1e4b1be0 Completed: Email Reader in 0:00:01.135, next occurrence is 09/06/2021 17:14:34 *******CauseScopes were missing below URLs instead have names like SMTP.Send and IMAP.AccessAsUser.All https://outlook.office365.com/IMAP.AccessAsUser.Allhttps://outlook.office365.com/SMTP.Send See attached screenshot. ResolutionAdded below URLs to the respective scopes in servicenow. https://outlook.office365.com/IMAP.AccessAsUser.All https://outlook.office365.com/SMTP.Send - Create a brand new Email Account (IMAP), this step is required - Authorize new account and test connection.Related LinksCheck below URL for additional info. https://stackoverflow.com/questions/61597263/office-365-xoauth2-for-imap-and-smtp-authentication-fails