node-imap
node-imap copied to clipboard
Authentication Failed on Sever, working on Localhost.
I am implementing IMAP with outlook.
Everything is working find on the local machine, but when I moved the code to server, it is returning authentication error.
Error: LOGIN failed. Account is blocked. Login to your account via a web browser to verify your identity.
0|plycoco-app | at Connection._resTagged (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:1502:11)
0|plycoco-app | at Parser.<anonymous> (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:194:10)
0|plycoco-app | at Parser.emit (events.js:223:5)
0|plycoco-app | at Parser._resTagged (/var/www/html/plycoco/server/node_modules/imap/lib/Parser.js:175:10)
0|plycoco-app | at Parser._parse (/var/www/html/plycoco/server/node_modules/imap/lib/Parser.js:139:16)
0|plycoco-app | at Parser._tryread (/var/www/html/plycoco/server/node_modules/imap/lib/Parser.js:82:15)
0|plycoco-app | at TLSSocket.Parser._cbReadable (/var/www/html/plycoco/server/node_modules/imap/lib/Parser.js:53:12)
0|plycoco-app | at TLSSocket.emit (events.js:223:5)
0|plycoco-app | at emitReadable_ (_stream_readable.js:576:12)
0|plycoco-app | at processTicksAndRejections (internal/process/task_queues.js:80:21)
0|plycoco-app | Emitted 'error' event on Connection instance at:
0|plycoco-app | at reentry (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:1610:12)
0|plycoco-app | at Connection.checkCaps (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:1635:22)
0|plycoco-app | at Connection._resTagged (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:1535:22)
0|plycoco-app | at Parser.<anonymous> (/var/www/html/plycoco/server/node_modules/imap/lib/Connection.js:194:10)
0|plycoco-app | [... lines matching original stack trace ...]
0|plycoco-app | at processTicksAndRejections (internal/process/task_queues.js:80:21) {
0|plycoco-app | type: 'no',
0|plycoco-app | textCode: undefined,
0|plycoco-app | source: 'authentication'
0|plycoco-app | }
Is there anything I need to update in my Outlook account? If so, please suggest.
Did you try logging into your account in a web browser to verify your identity, like it says in the first line of the error message?
You'll probably need to use OAuth instead of password authentication to avoid security barriers like this one.
Yes, I tried. And I don't need to add OAuth as I only have to get emails of a single account only. I am not sure why it is not working on the server but working locally. Is there anything I am missing?
Are you able to log in using the same set of credentials via the IMAP provider's webmail interface? Is two-factor authentication enabled on the account?
Yes! I am able to log in and no, I don't have two-factor authentication enabled.
I don't know what else to suggest then, other than to contact the support folks for the server in question.
Thanks!
i also facing same problems.
Could anyone please help on the same issue mentioned above,
{ type: 'no', textCode: undefined, source: 'authentication', level: 'error' }
The above is the error message that i am getting, login username and password is also correct. I tried debugging this, got the below,
<= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
<= 'A0 OK CAPABILITY completed.'
=> 'A1 LOGIN "************@*****.com" "**************"'
<= 'A1 NO LOGIN failed.'
[connection] Ended
[connection] Closed
[connection] Connected to host
<= '* OK The Microsoft Exchange IMAP4 service is ready. [TQBBAFgAUABSADAAMQAwADEAQwBBADAAMAAyADcALgBJAE4ARABQAFIARAAwADEALgBQAFIATwBEAC4ATwBVAFQATABPAE8ASwAuAEMATwBNAA==]'
=> 'A0 CAPABILITY'
<= '* CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+'
<= 'A0 OK CAPABILITY completed.'
=> 'A1 LOGIN "************@*****.com" "**************"'
<= 'A1 NO LOGIN failed.'
Please anyone help me to resolve this, i checked the complete world of stackoverflow, but nobody couldnt fix this. I appreciate if anyone has the solution.
export const imapConfig = { imap: { user: process.env.OUTLOOK_USER, password: '', host: process.env.OUTLOOK_HOST, port: Number(process.env.OUTLOOK_PORT || 993), tls: true, authTimeout: 25000, connTimeout: 30000, keepalive: true, secure: true, debug: console.log tlsOptions: { rejectUnauthorized: false servername: process.env.OUTLOOK_HOST host: process.env.OUTLOOK_HOST } } }
Did anyone manage to fix the issue? My Authentication has stopped working.
I'm also facing the same issue. Did you find a fix @gsaravanakumar932?