From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.devel Subject: Re: oauth2 support for Emacs email clients Date: Wed, 04 Aug 2021 15:21:14 +0800 Organization: Hong Kong University of Science and Technology Message-ID: <87h7g5llp1.fsf@ust.hk> References: <52589.36892.953561.24840@gargle.gargle.HOWL> <87r1fb7xbk.fsf@ust.hk> <87a6lxhesg.fsf@gnus.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3810"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) To: emacs-devel@gnu.org Cancel-Lock: sha1:2sVJXZt5JRnsUIQKV64iADu2KMk= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Aug 04 09:22:11 2021 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mBBEA-0000kS-Jl for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Aug 2021 09:22:10 +0200 Original-Received: from localhost ([::1]:35554 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mBBE9-0001LL-IG for ged-emacs-devel@m.gmane-mx.org; Wed, 04 Aug 2021 03:22:09 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:47686) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBBDV-0000dU-CK for emacs-devel@gnu.org; Wed, 04 Aug 2021 03:21:29 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]:42862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mBBDT-0000bL-Ax for emacs-devel@gnu.org; Wed, 04 Aug 2021 03:21:29 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1mBBDR-000ALf-C0 for emacs-devel@gnu.org; Wed, 04 Aug 2021 09:21:25 +0200 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -26 X-Spam_score: -2.7 X-Spam_bar: -- X-Spam_report: (-2.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.248, NICE_REPLY_C=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:272021 Archived-At: >>>>> "LI" == Lars Ingebrigtsen writes: LI> Andrew Cohen writes: >> It requires two minor lisp changes (which I haven't yet pushed to >> master): one for imap support of xoauth2, the other for smtpmail >> support (see below). LI> The patch looks good to me -- I can push it to Emacs 28 if you LI> want? Yes please. Ideally this should come with some documentation updates:) For imap usage the relevant paragraph in "Customizing the IMAP Connection" should read: ‘nnimap-authenticator’ Some IMAP servers allow anonymous logins. In that case, this should be set to ‘anonymous’. If this variable isn’t set, the normal login methods will be used. If you wish to specify a specific login method to be used, you can set this variable to either ‘login’ (the traditional IMAP login method), ‘plain’, ‘cram-md5’, or ‘xoauth2’ (to use oauth2). For the smtp usage the last paragraph of the SMTP authentication section needs updating. Actually, I think it is currently mistaken (it says that it tries various authentication methods in order, but as I recall if one method fails it doesn't fall through to others). So ideally this whole paragraph would get rewritten. But a temporary fix is The process by which the SMTP library authenticates you to the server is known as “Simple Authentication and Security Layer” (SASL). There are various SASL mechanisms, and this library supports four of them: CRAM-MD5, PLAIN, LOGIN, and XOAUTH2 where the first uses a form of encryption to obscure your password, the next two do not, and the fourth uses the oauth2 protocol. It tries each of them, in that order, until one succeeds. You can override this by assigning a specific authentication mechanism to a server by including a key ‘smtp-auth’ with the value of your preferred mechanism in the appropriate ‘~/.authinfo’ entry. Thanks, Andy --