Closed Bug 1778576 Opened 2 years ago Closed 2 years ago

POP3 fails to retrieve messages when using OAuth2 (some cases, notably office365 pop)

Categories

(MailNews Core :: Networking: POP, defect, P1)

Thunderbird 102

Tracking

(thunderbird_esr102+ fixed, thunderbird103 fixed)

RESOLVED FIXED
104 Branch
Tracking Status
thunderbird_esr102 + fixed
thunderbird103 --- fixed

People

(Reporter: dbloughner, Assigned: rnons)

References

(Blocks 1 open bug, Regression)

Details

(Keywords: regression)

Attachments

(1 file)

Steps to reproduce:

Get Messages -> <any pop account configured with oauth2>

Actual results:

message "Host contacted, sending contact information..." appears indefinitely; no email messages are retrieved.
IMAP accounts configured with oauth2, and pop accounts with basic authentication retrieve email as expected.

Expected results:

"Host contacted" message should appear briefly, followed by number of messages retrieved.

Blocks: tb102found

Thanks for reporting, I tested with a gmail/oauth2/pop3 account just now, seems to work for me. Can you go to Config Editor, set mailnews.pop3.loglevel to All, to get some debug logs?

Component: Untriaged → Networking: POP
Product: Thunderbird → MailNews Core
Summary: pop fails to retrieve messages when using oauth2 → POP3 fails to retrieve messages when using OAuth2

https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#pop-protocol-exchange

says "o authenticate a POP server connection, the client will have to respond with an AUTH command split into two lines "

Using the ctrl-shift-J, and debug level=All I see
C: Logging suppressed (it probably contained auth info) Pop3Client.jsm:418:20
S: -ERR Protocol error. Connection is closed. 10 Pop3Client.jsm:302:18
Connection closed. Pop3Client.jsm:325:18

And if I look at Pop3Client.jsm:418:20 and poke around a little I find
this._send(`AUTH XOAUTH2 ${token}, true);

Note no apparent line break before ${token} ; i.e., not split into two lines as suggested by the Microsoft link above.

Since updating to TB 102.0, POP3 has not worked (with OAuth2)

(In reply to Ping Chen (:rnons) from comment #1)

Thanks for reporting, I tested with a gmail/oauth2/pop3 account just now, seems to work for me. Can you go to Config Editor, set mailnews.pop3.loglevel to All, to get some debug logs?

Below are the relevant lines from error log. Note that the POP3 server is Microsoft Exchange:

mailnews.pop3.94: Connecting to pop://outlook.office365.com:995 Pop3Client.jsm:129:18
mailnews.pop3.94: Connected Pop3Client.jsm:261:18
mailnews.pop3.94: S: +OK The Microsoft Exchange POP3 service is ready. [QgBZAEEAUABSADAANQBDAEEAMAAwADMAMAAuAG4AYQBtAHAAcgBkADAANQAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A]
Pop3Client.jsm:302:18
mailnews.pop3.94: C: CAPA Pop3Client.jsm:424:20
mailnews.pop3.94: S: +OK
TOP
UIDL
SASL PLAIN XOAUTH2
USER
.
Pop3Client.jsm:302:18
mailnews.pop3.94: Possible auth methods: XOAUTH2 Pop3Client.jsm:501:18
mailnews.pop3.94: Current auth method: XOAUTH2 Pop3Client.jsm:577:18
mailnews.pop3.94: C: Logging suppressed (it probably contained auth information) Pop3Client.jsm:418:20
mailnews.pop3.94: Connection closed. Pop3Client.jsm:325:18
mailnews.pop3.94: S: -ERR Protocol error. Connection is closed. 10 Pop3Client.jsm:302:18

(In reply to Paul D from comment #2)

https://docs.microsoft.com/en-us/exchange/client-developer/legacy-protocols/how-to-authenticate-an-imap-pop-smtp-application-by-using-oauth#pop-protocol-exchange

says "o authenticate a POP server connection, the client will have to respond with an AUTH command split into two lines "

Using the ctrl-shift-J, and debug level=All I see
C: Logging suppressed (it probably contained auth info) Pop3Client.jsm:418:20
S: -ERR Protocol error. Connection is closed. 10 Pop3Client.jsm:302:18
Connection closed. Pop3Client.jsm:325:18

And if I look at Pop3Client.jsm:418:20 and poke around a little I find
this._send(`AUTH XOAUTH2 ${token}, true);

Note no apparent line break before ${token} ; i.e., not split into two lines as suggested by the Microsoft link above.

Makes sense, I will make a fix today, thanks.

Assignee: nobody → remotenonsense
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Keywords: regression
Regressed by: pop3-js
Severity: -- → S2
Priority: -- → P1
Target Milestone: --- → 104 Branch

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/12cd0f90e648
Break AUTH XOAUTH2 to two steps in Pop3Client to make some servers happy. r=#thunderbird-reviewers,mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

Comment on attachment 9284792 [details]
Bug 1778576 - Break AUTH XOAUTH2 to two steps in Pop3Client to make some servers happy. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #): bug 1707548
User impact if declined: OAuth doesn't work for some pop3 servers.
Testing completed (on c-c, etc.): c-c
Risk to taking this patch (and alternatives if risky): low

Attachment #9284792 - Flags: approval-comm-beta?
Summary: POP3 fails to retrieve messages when using OAuth2 → POP3 fails to retrieve messages when using OAuth2 (some cases, notably office365 pop)

Comment on attachment 9284792 [details]
Bug 1778576 - Break AUTH XOAUTH2 to two steps in Pop3Client to make some servers happy. r=#thunderbird-reviewers

[Triage Comment]
Approved for beta

Attachment #9284792 - Flags: approval-comm-beta? → approval-comm-beta+

Comment on attachment 9284792 [details]
Bug 1778576 - Break AUTH XOAUTH2 to two steps in Pop3Client to make some servers happy. r=#thunderbird-reviewers

[Approval Request Comment]
Regression caused by (bug #): bug 1707548
User impact if declined: OAuth doesn't work for some pop3 servers.
Testing completed (on c-c, etc.): beta
Risk to taking this patch (and alternatives if risky): low

Attachment #9284792 - Flags: approval-comm-esr102?

Comment on attachment 9284792 [details]
Bug 1778576 - Break AUTH XOAUTH2 to two steps in Pop3Client to make some servers happy. r=#thunderbird-reviewers

[Triage Comment]
Approved for esr102

Attachment #9284792 - Flags: approval-comm-esr102? → approval-comm-esr102+
Regressions: 1784842
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: