Add richer authentication support for POP3

That’s great indeed, TLS is also a requirement for Exchange Online. But still, authentication is made by basic-auth (if I understand well the following code, there is no way to choose between any other authentication mechanism like OAuth2) discourse/poll_mailbox.rb at tests-passed · discourse/discourse (github.com)

Tracing down a bit more, it seems that the Class: Net::POP3 (Ruby 2.7.0) (ruby-doc.org) library in Ruby does not support OAuth2 authentication, just basic one.

For reference:

It just expects a user and a password, rather than a user and a token, plus it would need to use the AUTH XOAUTH2 format for encoding and transmitting the token.

Sorry if I was not clear in my question, but I’m more asking about having a similar approach as per the following examples:

These approaches will allow Discourse to connect to POP3 (and hence IMAP) with OAuth2 authentication, thus fullfilling the requirements for MS and probably for GMail in the near future if not now ( OAuth 2.0 Mechanism | Gmail IMAP | Google Developers).

Cheers,
Ismael

6 Likes

I think this is a very fine feature request and I very much support adding OAuth2 support to POP3.

Can’t commit though to when we can build it, but if a PR popped up we would certainly prioritize reviewing and merging it

7 Likes

Awesome, thank you so much! :clap:

Looking forward to seeing this feature around!

Cheers,
Ismael