Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP authentication - what does this error message mean? #894

Open
henryp0p opened this issue Jan 4, 2023 · 5 comments
Open

IMAP authentication - what does this error message mean? #894

henryp0p opened this issue Jan 4, 2023 · 5 comments

Comments

@henryp0p
Copy link

henryp0p commented Jan 4, 2023

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?

@baranbbr
Copy link

baranbbr commented Jan 4, 2023

This looks correct, check your credentials and lastly Outlook have updated their website with IMAP connection errors, maybe this could help?

https://support.microsoft.com/en-us/topic/d088b986-291d-42b8-9564-9c414e2aa040

@henryp0p
Copy link
Author

henryp0p commented Jan 5, 2023

It looks like Outlook has recently stopped supporting Basic Auth through IMAP
https://learn.microsoft.com/en-us/exchange/troubleshoot/administration/cannot-connect-mailbox-pop-imap-outlook

I think this might be the cause of the error.

@henryp0p
Copy link
Author

henryp0p commented Jan 5, 2023

@baranbbr thanks, I've read through their docs on this and enabled IMAP in the account so it doesn't look like this explains it

@shailendra-fxbytes
Copy link

It looks like Outlook has recently stopped supporting Basic Auth through IMAP https://learn.microsoft.com/en-us/exchange/troubleshoot/administration/cannot-connect-mailbox-pop-imap-outlook

I think this might be the cause of the error.

hello @henryp0p i have check the document and yes basic auth is disabled now so i have tried it with auth2.0 and adding token like this

const mailId = 'sstest**@******.com';
const token =
'eyJ0eXAiOiJKV1QiLCJub25jZSI6ImRvd3R0S2draG1fVGN1T1g3S1p................';
const auth2 = btoa('user=' + mailId + '^Aauth=Bearer ' + token + '^A^A');

var imap = new Imap({
xoauth2: auth2,
host: 'outlook.office365.com',
port: 993,
tls: true,
debug: console.log,
authTimeout: 25000,
connTimeout: 30000,
tlsOptions: {
rejectUnauthorized: false,
servername: 'outlook.office365.com'
}
});

But now it gives error - IMAP Server Error Error: No supported authentication method(s) available. Unable to login.

Can you help me with this error. My project is already using your plugin and if it not worked i have to make all the things custom and which take too much time.

Waiting for your positive response.

@henryp0p
Copy link
Author

it's been disabled now so as far as I understand you would have to change your email provider or create an Azure app with outlook access. Good luck

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants