mail icon indicating copy to clipboard operation
mail copied to clipboard

IMAP fails to connect to Office 365 with App Password

Open revr3nd opened this issue 3 years ago • 1 comments

Steps to reproduce

  1. Have an Office 365 account with 2FA enabled
  2. Generate an App Password to be used with Nextcloud Mail
  3. Install Nextcloud Mail app
  4. Manually add an IMAP account with the expected office 365 settings

Expected behavior

IMAP should connect without issue and present the mail screen upon adding an account

Actual behavior

Authentication always seems to fail with the same message: Manual config failed. IMAP username or password is wrong.

Upon enabling debug, the horde_imap.log shows the following (username redacted):

Thu, 01 Sep 2022 18:20:02 +0000 Connection to: imap://outlook.office365.com:993/ Server connection took 0.0804 seconds. S: * OK The Microsoft Exchange IMAP4 service is ready. [QgBZAEEAUABSADAANgBDAEEAMAAwADEAMAAuAG4AYQBtAHAAcgBkADAANgAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A] C: 1 CAPABILITY S: * CAPABILITY IMAP4 IMAP4rev1 AUTH=PLAIN AUTH=XOAUTH2 SASL-IR UIDPLUS MOVE ID UNSELECT CHILDREN IDLE NAMESPACE LITERAL+ S: 1 OK CAPABILITY completed. Command 1 took 0.0193 seconds. C: 2 AUTHENTICATE PLAIN [INITIAL CLIENT RESPONSE (username: [email protected])] S: 2 NO AUTHENTICATE failed. Command 2 took 2.2191 seconds.

Mail app version

1.13.8

Mailserver or service

Office 365 IMAP

Operating system

Debian 11, Docker Nextcloud AIO 1.7.1

PHP engine version

No response

Web server

No response

Database

No response

Additional info

No response

revr3nd avatar Sep 01 '22 18:09 revr3nd

Related: https://github.com/nextcloud/mail/issues/6591. Though I hope that is not in effect yet.

ChristophWurst avatar Sep 01 '22 18:09 ChristophWurst

I'm closing this issue as app passwords have been discontinued and XOAUTH2 was implemented.

st3iny avatar May 02 '23 13:05 st3iny