mguessan / davmail

DavMail POP/IMAP/SMTP/Caldav/Carddav/LDAP Exchange and Office 365 Gateway - Synced with main subversion repository at
http://davmail.sourceforge.net
GNU General Public License v2.0
580 stars 86 forks source link

Authentication failed: invalid user or password #349

Open UlyssesZh opened 6 months ago

UlyssesZh commented 6 months ago

I ran into this problem on 6.2.2 for one of my outlook accounts. My other two outlook accounts are not affected. Context: https://github.com/mguessan/davmail/issues/288#issuecomment-2085576585

log ``` 2024-04-30 23:41:25,691 DEBUG [davmail.imap.ImapServer] davmail - Connection from /169.231.127.132 on port 1143 2024-04-30 23:41:25,691 INFO [davmail.imap.ImapServer] davmail.connection - CONNECT - 169.231.127.132:46718 2024-04-30 23:41:25,736 DEBUG [ImapConnection-46718] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:25,883 DEBUG [ImapConnection-46718] davmail.exchange.ExchangeSession - Test configuration status: 401 2024-04-30 23:41:25,884 DEBUG [ImapConnection-46718] davmail - > * OK [CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE SPECIAL-USE UIDPLUS] IMAP4rev1 DavMail 6.2.2-3546 server ready 2024-04-30 23:41:26,214 DEBUG [ImapConnection-46718] davmail - < 30 authenticate LOGIN 2024-04-30 23:41:26,215 DEBUG [ImapConnection-46718] davmail - > + VXNlcm5hbWU6 2024-04-30 23:41:26,298 DEBUG [ImapConnection-46718] davmail - < XXXXXXXXXXXXXXXXXXXXXXXX= 2024-04-30 23:41:26,298 DEBUG [ImapConnection-46718] davmail - > + UGFzc3dvcmQ6 2024-04-30 23:41:26,385 DEBUG [ImapConnection-46718] davmail - < ******** 2024-04-30 23:41:26,385 DEBUG [ImapConnection-46718] davmail.exchange.ExchangeSession - Direct EWS authentication 2024-04-30 23:41:26,385 DEBUG [ImapConnection-46718] davmail.http.HttpClientAdapter - Creating NTCredentials for user xxxxxxxx@outlook.com workstation 7493407be0fc domain 2024-04-30 23:41:26,409 DEBUG [ImapConnection-46718] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:27,185 DEBUG [ImapConnection-46718] davmail.http.HttpClientAdapter - Add cookie [version: 0][name: exchangecookie][value: 07e3fd0eb4164acc80d58633ff74e564][domain: outlook.office365.com][path: /][expiry: Wed Apr 30 23:41:27 GMT 2025] 2024-04-30 23:41:27,185 INFO [ImapConnection-46718] davmail.connection - FAILED - 169.231.127.132:46718 xxxxxxxx@outlook.com 2024-04-30 23:41:27,185 ERROR [ImapConnection-46718] davmail - Authentication failed: invalid user or password davmail.exception.DavMailAuthenticationException: Authentication failed: invalid user or password at davmail.exchange.ews.EwsExchangeSession.checkEndPointUrl(EwsExchangeSession.java:228) at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:237) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:176) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:205) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:192) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93) at davmail.imap.ImapConnection.run(ImapConnection.java:155) 2024-04-30 23:41:27,186 DEBUG [ImapConnection-46718] davmail - > 30 NO LOGIN failed 2024-04-30 23:41:27,287 DEBUG [ImapConnection-46718] davmail - < LOGIN ******** 2024-04-30 23:41:27,287 DEBUG [ImapConnection-46718] davmail.exchange.ExchangeSession - Direct EWS authentication 2024-04-30 23:41:27,287 DEBUG [ImapConnection-46718] davmail.http.HttpClientAdapter - Creating NTCredentials for user xxxxxxxx@outlook.com workstation 7493407be0fc domain 2024-04-30 23:41:27,307 DEBUG [ImapConnection-46718] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:27,363 DEBUG [davmail.imap.ImapServer] davmail - Connection from /169.231.127.132 on port 1143 2024-04-30 23:41:27,363 INFO [davmail.imap.ImapServer] davmail.connection - CONNECT - 169.231.127.132:46724 2024-04-30 23:41:27,388 DEBUG [ImapConnection-46724] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:27,548 DEBUG [ImapConnection-46724] davmail.exchange.ExchangeSession - Test configuration status: 401 2024-04-30 23:41:27,548 DEBUG [ImapConnection-46724] davmail - > * OK [CAPABILITY IMAP4REV1 AUTH=LOGIN MOVE SPECIAL-USE UIDPLUS] IMAP4rev1 DavMail 6.2.2-3546 server ready 2024-04-30 23:41:27,943 DEBUG [ImapConnection-46724] davmail - < 94 authenticate LOGIN 2024-04-30 23:41:27,943 DEBUG [ImapConnection-46724] davmail - > + VXNlcm5hbWU6 2024-04-30 23:41:28,029 DEBUG [ImapConnection-46724] davmail - < XXXXXXXXXXXXXXXXXXXXXXXX= 2024-04-30 23:41:28,029 DEBUG [ImapConnection-46724] davmail - > + UGFzc3dvcmQ6 2024-04-30 23:41:28,078 DEBUG [ImapConnection-46718] davmail.http.HttpClientAdapter - Add cookie [version: 0][name: exchangecookie][value: 7867d5a94fa34eeba900d43ac4867cc7][domain: outlook.office365.com][path: /][expiry: Wed Apr 30 23:41:27 GMT 2025] 2024-04-30 23:41:28,078 INFO [ImapConnection-46718] davmail.connection - FAILED - 169.231.127.132:46718 xxxxxxxx@outlook.com 2024-04-30 23:41:28,078 ERROR [ImapConnection-46718] davmail - Authentication failed: invalid user or password davmail.exception.DavMailAuthenticationException: Authentication failed: invalid user or password at davmail.exchange.ews.EwsExchangeSession.checkEndPointUrl(EwsExchangeSession.java:228) at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:237) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:176) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:205) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:192) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93) at davmail.imap.ImapConnection.run(ImapConnection.java:128) 2024-04-30 23:41:28,078 DEBUG [ImapConnection-46718] davmail - > 32 NO LOGIN failed 2024-04-30 23:41:28,115 DEBUG [ImapConnection-46724] davmail - < ******** 2024-04-30 23:41:28,115 DEBUG [ImapConnection-46724] davmail.exchange.ExchangeSession - Direct EWS authentication 2024-04-30 23:41:28,116 DEBUG [ImapConnection-46724] davmail.http.HttpClientAdapter - Creating NTCredentials for user xxxxxxxx@outlook.com workstation 7493407be0fc domain 2024-04-30 23:41:28,143 DEBUG [ImapConnection-46724] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:28,913 DEBUG [ImapConnection-46724] davmail.http.HttpClientAdapter - Add cookie [version: 0][name: exchangecookie][value: a15f3d5b77ba4f26b1527e6cd5671d74][domain: outlook.office365.com][path: /][expiry: Wed Apr 30 23:41:28 GMT 2025] 2024-04-30 23:41:28,913 INFO [ImapConnection-46724] davmail.connection - FAILED - 169.231.127.132:46724 xxxxxxxx@outlook.com 2024-04-30 23:41:28,913 ERROR [ImapConnection-46724] davmail - Authentication failed: invalid user or password davmail.exception.DavMailAuthenticationException: Authentication failed: invalid user or password at davmail.exchange.ews.EwsExchangeSession.checkEndPointUrl(EwsExchangeSession.java:228) at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:237) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:176) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:205) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:192) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93) at davmail.imap.ImapConnection.run(ImapConnection.java:155) 2024-04-30 23:41:28,913 DEBUG [ImapConnection-46724] davmail - > 94 NO LOGIN failed 2024-04-30 23:41:29,005 DEBUG [ImapConnection-46724] davmail - < LOGIN ******** 2024-04-30 23:41:29,005 DEBUG [ImapConnection-46724] davmail.exchange.ExchangeSession - Direct EWS authentication 2024-04-30 23:41:29,005 DEBUG [ImapConnection-46724] davmail.http.HttpClientAdapter - Creating NTCredentials for user xxxxxxxx@outlook.com workstation 7493407be0fc domain 2024-04-30 23:41:29,054 DEBUG [ImapConnection-46724] davmail.http.DavGatewaySSLSocketFactory - createSocket outlook.office365.com 443 2024-04-30 23:41:29,828 DEBUG [ImapConnection-46724] davmail.http.HttpClientAdapter - Add cookie [version: 0][name: exchangecookie][value: 59248e56a0b64ab699b541806405e775][domain: outlook.office365.com][path: /][expiry: Wed Apr 30 23:41:29 GMT 2025] 2024-04-30 23:41:29,828 INFO [ImapConnection-46724] davmail.connection - FAILED - 169.231.127.132:46724 xxxxxxxx@outlook.com 2024-04-30 23:41:29,828 ERROR [ImapConnection-46724] davmail - Authentication failed: invalid user or password davmail.exception.DavMailAuthenticationException: Authentication failed: invalid user or password at davmail.exchange.ews.EwsExchangeSession.checkEndPointUrl(EwsExchangeSession.java:228) at davmail.exchange.ews.EwsExchangeSession.buildSessionInfo(EwsExchangeSession.java:237) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:176) at davmail.exchange.ews.EwsExchangeSession.(EwsExchangeSession.java:205) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:192) at davmail.exchange.ExchangeSessionFactory.getInstance(ExchangeSessionFactory.java:93) at davmail.imap.ImapConnection.run(ImapConnection.java:128) 2024-04-30 23:41:29,829 DEBUG [ImapConnection-46724] davmail - > 96 NO LOGIN failed ```

I ran into this problem last night, and then the problem disappeared this morning. It then happens again this afternoon. I did not restart the server during the process or did anything.

mguessan commented 6 months ago

Most likely a server side issue then.

I found it strange that you can still access outlook.office365.com with simple username/password on EWS endpoint, and with an outlook.com account. Is this a personal (not company) account?

UlyssesZh commented 6 months ago

This is a personal account registered 5 years ago.

UlyssesZh commented 6 months ago

Do you mean I may have to use Office 365 modern authentication?