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:
- Ruby Office365 OAuth2 Resource Owner Password Credentials Grant for SMTP, IMAP, POP (example-code.com)
- or more “grafically” explained in this perl example Net::POP3::XOAuth2 - It enables to use XOAUTH2 authentication with Net::POP3 - metacpan.org
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).