Why Does Imap Authentication Fail on My Outlook Hosted Email?

I am using IMAP to access an Outlook inbox.

I am authenticating as so, taking the IMAP info from the account:

    var imap = new Imap({
        user: user.name,
        password: user.pass,
        host: 'outlook.office365.com',
        port: 993,
        tls: true
      });

This returns the following error

Error: LOGIN failed.
    at Connection._resTagged (/node_modules/imap/lib/Connection.js:1502:11)
    at Parser.<anonymous> (/node_modules/imap/lib/Connection.js:194:10)
    at Parser.emit (node:events:527:28)
    at Parser._resTagged (/node_modules/imap/lib/Parser.js:175:10)
    at Parser._parse (/node_modules/imap/lib/Parser.js:139:16)
    at Parser._tryread (/node_modules/imap/lib/Parser.js:82:15)
    at TLSSocket.Parser._cbReadable (/node_modules/imap/lib/Parser.js:53:12)
    at TLSSocket.emit (node:events:527:28)
    at emitReadable_ (node:internal/streams/readable:578:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'no',
  textCode: undefined,
  source: 'authentication'
}

I can't find any info on this error, can you see what I'm missing?

4

1 Answer

It looks like Outlook has recently stopped supporting Basic Auth through IMAP

This seems to be the cause for the error. For anyone looking to get access to mail on an outlook server I'd recommend looking into creating an Azure app and using Microsoft's GraphQL API. That's worked for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Chloe Bennett

Chloe Bennett

Culture, Media & Entertainment Columnist

Chloe Bennett explores the intersection of pop culture, streaming entertainment, digital trends, and contemporary lifestyle. Her weekly commentary reaches thousands of culture enthusiasts.

Share this article
Twitter Facebook Pinterest