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.bugs Subject: bug#72992: 29.4; towards xoauth2 support in Emacs Date: Thu, 19 Sep 2024 13:13:00 +0800 Message-ID: <878qvocjkz.fsf@ust.hk> References: <87h6ayfo87.fsf_-_@debian-hx90.lan> <877cb8oihg.fsf@debian-hx90.lan> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="27211"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Ted Zlatanov , Philip Kaludercic , 72992@debbugs.gnu.org, Stefan Kangas To: Xiyue Deng Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Sep 19 07:14:14 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1sr9Ua-0006y1-RM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Sep 2024 07:14:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sr9UD-0004YI-GN; Thu, 19 Sep 2024 01:13:49 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sr9U9-0004IK-AB for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 01:13:47 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sr9U9-00028J-06 for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 01:13:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=jQn+YDGL4SweyDudvw+s0StmGxQ4UKm6ixXjnxA8OAQ=; b=Bkgz35n2xe6HHJLKATdxzKiogzSpC0uR1pc2EJvwmbr/W/1AglF1uPMqC4+c6dNuMZmgb2+xBa1dz0JZZWN0ZdFaYQ3GoiBOv2LfI+k4sBiLo+dACo0Njc9SxYwt5jEwfbRWDFOva8UF+uUZGOtQeJNZQkdtYO8WCWswom71hCZeX/Fk58Eah3gZGDPgCcAyPFXWZquq652qfBXDTu+2mUSnAgGzP4B/qbQmvuZt0o42JZoQuBw90I5F/uSttajU7M/RGR6FCIzkHq9jMIlSLCh3HRHxS7Nk7HNTVPkdr1Ic4kijJsQn6OGrzTnlm7V5r2aCSsHmfFy8GlX2ceUNXg==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sr9UP-0005L4-JO for bug-gnu-emacs@gnu.org; Thu, 19 Sep 2024 01:14:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andrew Cohen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Sep 2024 05:14:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72992 X-GNU-PR-Package: emacs Original-Received: via spool by 72992-submit@debbugs.gnu.org id=B72992.172672281620477 (code B ref 72992); Thu, 19 Sep 2024 05:14:01 +0000 Original-Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 05:13:36 +0000 Original-Received: from localhost ([127.0.0.1]:59595 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sr9Tz-0005K9-JG for submit@debbugs.gnu.org; Thu, 19 Sep 2024 01:13:36 -0400 Original-Received: from mail-japaneastazon11021142.outbound.protection.outlook.com ([52.101.125.142]:27694 helo=TYVP286CU001.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sr9Tv-0005Jm-F3 for 72992@debbugs.gnu.org; Thu, 19 Sep 2024 01:13:33 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Txq+tKg3YvE0Rrah+SdHien9Po2uUPUrlepUuDfKappryEoXWm3aXvL2umcPDX1IoP093qWL8/S9AADx0lflstzI6DLCwEUxPpI8VInXtrr3mBnoetTLeWig0XdyWRU8dWO7pAWcrtWwAWDiisO3rHAo1FR+mr49Av/qgoARcaXTzM4zb4Aeid6K/OzMTYkC1jKJLwr0WKzcCHSpUjbcWr1DUNvtS2eDWb9yB/wyHJWkwzGwiJITiNVYhbNQ5VuFXdDZnl6zAg7kFkuuu86zEwT7ZxURFbV7A2plvh80334TX794DLXqweWslzP4KAXzOImDFdJz0dfuie3VTEptiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=jQn+YDGL4SweyDudvw+s0StmGxQ4UKm6ixXjnxA8OAQ=; b=q2K6XuYe+c0fvKFfymGzUejgJF5H8UxQbhvb6mqBIm+6TOFgvNRaOwAmR84PtcvigHTcbv4+TKbiwBGYzs97S+8hYmHVkZ8cbM83yox6IEXGfUKabNLT4JG2V7js7W1NHZW0kF3xjAdToYGBrMLISVBrDVuVyfLydWGeyL2Q1EjMeBLIVNPrQM2b06Kq2ZIOXB0HCZt8XD2JPCmWk2NhD78zzzg5XKZ+dS8/HGlD1PRjoXmpihbB3i/wyKluRnwwi9STp8OT7Srd3PyF4Ly/saxAZ9LyeZIm2cTpkAR3ySXCM62EhaOfZ1OqKU+ua5PWdNsyseTHPPfRb73b4h0Ohw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=ust.hk; dmarc=pass action=none header.from=ust.hk; dkim=pass header.d=ust.hk; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ust.hk; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=jQn+YDGL4SweyDudvw+s0StmGxQ4UKm6ixXjnxA8OAQ=; b=Ng6qCREYKEv9YI6fG2s0YyOe6rZkFQcKN0Y6LufREimzYrDfSSsvnzmbcqTrhrbxgzLCYgLtHvjqMv0qsEIajYzg0cZu/2kFL+s11k1Sg23yjyFvk/gho/mOuQcyGfsJ/Lo+w9syBt8qF+05GloW4pVAXYZ5/OUImFacPGeRcJHLUD7rHi3WFjgcrqhUJRBC8yzfxuABePhTlAWGCvZ2mCKJJW25lpj8PQhYGTGHqvgyXLmCPVXXnFMG8g1zuxjXzNGTyUQ0IPahG4WYbby/XPrKbRkOHrF0Usf3vStagszRNa9AY9WMBicw7/dVi+mwtrSCOcjW7mBNkzlfyZoOjQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=ust.hk; Original-Received: from OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:167::9) by TYWP286MB2468.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:167::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7982.19; Thu, 19 Sep 2024 05:13:07 +0000 Original-Received: from OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM ([fe80::e097:a79c:e231:14c9]) by OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM ([fe80::e097:a79c:e231:14c9%5]) with mapi id 15.20.7982.012; Thu, 19 Sep 2024 05:13:06 +0000 In-Reply-To: <877cb8oihg.fsf@debian-hx90.lan> X-ClientProxiedBy: KL1PR01CA0019.apcprd01.prod.exchangelabs.com (2603:1096:820::31) To OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:167::9) X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OSZP286MB1870:EE_|TYWP286MB2468:EE_ X-MS-Office365-Filtering-Correlation-Id: b8406538-bd29-4682-2008-08dcd869beb5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: fmFRbx8PV4DVkUh4cX8XYn+oWj5RM0sm7XyDvHifKPvvOU/sqw3ItjhzLYhj7FV5FTH25PI99gBSOMOoxbbmOytmrRc1MlPm1eqR5E+roHSW3b9OZ1bbTMl4lTMQNQ9jZrH+c3IT1LCtqa/K5dquG3NHEUPfdqNN6lPqK2tePbsa/WtegPUaqc+bKIMK0URy4vgk30Y9nYE5YoLiJhmhwzaYTt5t51io7IcM99WiJgid9o8+HnC9pZeUzuRTbNswgBTJ0vR4lLfAgFnbT4hYuwfoZthC/cgy76VS/a/vZODh3lbQ0G27vFEeQKE7UhSqi95e919HMX+7/uUwjwrNCzL2GODDY3sHslYo/FqVZ8rLLO57sFt0KGyO8/gPigaUjNJBxpPZjSxdOn9/VB3MjXouSj6+2MAgVqQn9hNbU0smSq5SJkX8fTrc75dKCEmxJfSNc3J9N5IUWwvVk3njG3TvvV+1rLV5jyIvhOuJSDLyqTN/y/Y5vnzIX/9DEsCvjt8OJxYQi4r0Em53Z33YDNcnQVj/iofOwWQF0tirDujNZ214uP0BkjMaQOWRyUuXFmh/vXLPLXmCxjlU47uAfVzZQIGwTAmFOqY2mk1KgbqSFArErWbNJTAmond9qysrume2u/4Orj4LmGKPUqL8+PlViydicy+YVCAH+gcXMIvkTVdvfNitU0LQN/9fPUWkJ71lPyxpSGcSVMqnNoa8+swIWDtPaGInMhUmNu6012eli6qAQMyxs0K4JcTIk vBbvtj/oxr48r1pUfKs8S5dfxmBeiTsMCMkArelYowE71/aGCXDotzuS9zofQWiIjo5OQADdRQq4BnrgDSMt14ebV7u5bxt7cS X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 7B+mhxyLfAhgRUp6kszdrHZVBHXAavxDGvh634kClNueOdCQg/bEMeXoCsuME9wjoJ9MBffdGkaAyUhdmmbsgbMsZqBdKcST++sIk1LWLjoFVaczgYLhhPp3EsnlAPjro7mBDOVXiBMrHkOzMDtd9dKtL2i9dp5WXGlznKWI81BXW7DFCdv4gNSM+wi5l7AKGkz1mP0efekm6TYGcYbuH6VU1GXhdcczzTyBVen3V+HcmPE5AQtTPxwLFpAGYqVyW00ByKvwcomwOfa47z0E2GLkAvfyjiF3tVZQtmhY4jzYLcE9Vk6ZpdIwqXF065cPC+mwMbLJ0TSSvwMVby0P+OU01Fwolpld9K7o//FMO+thdiJy/rxz4lWUvXywL6iic3MuOXDOjjdHOd3sr4ByyYOW0i19f1G1yNxocAcmLhlTEIBP5xTZy+mP3YkFi7usGHLfShSYwuwh13A6YLQqtJfAJxg8jvcM/X+2zzfnjxvLlMg+tghc8l5fsrjm9LWvTgQr8qcw4EVGzrSFghnHSHOPZeIlhabTwDzdgjFjHHmlwVd3XKlVJ5jJ7R4K42p+PoGzWe5JXZxR9WKeOlHp7HfveqrlJvXB7PlYvlOcQ6/55XrGzQgPKiMr1yPg2iyPruCSaV0QhdOaFLqfaxIkouUjMKNtWjjFgWZfCDg6JpNKvy2MdXCjf7qyGbVgOfMqWDbhrPOfK55EFKgMo1OOh6hMugiM01eEeTydx3mytUTV3Z/YyvXrDIz+sp BJi7pnNseO5MoIdhZGo1SYVCah358BJL3o8la6xBTacByOVGHvedvdjGrzJs4UYTEDU/Mo8wRv6jx1YiqDC4f8Mn2ZT6FYRHXg X-OriginatorOrg: ust.hk X-MS-Exchange-CrossTenant-Network-Message-Id: b8406538-bd29-4682-2008-08dcd869beb5 X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 05:13:06.8226 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: c917f3e2-9322-4926-9bb3-daca730413ca X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: csZaHndQBpZfggKcg7fxoFzoK75jjkIajR59/juib3TQokVhtK7wE23+5rxYBWeC X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYWP286MB2468 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:292026 Archived-At: >>>>> "XD" == Xiyue Deng writes: XD> Hi Stefan, Stefan Kangas writes: >> Xiyue Deng writes: >> [...] >>> Currently, auth-source search requires that the result include >>> `:secret' most of the time, where when using xoauth2 it is >>> actually the access-token. Actually, auth-source has existing >>> support for xoauth2 authentication, though it assumes that the >>> password value actually stores the access-token. >> >> Where can we find this "existing support"? Do you mean the >> 'auth-source-xoauth2' package on GNU ELPA? >> XD> The basic support is actually in the Emacs core already, XD> e.g. for Gnus nnimap[2] and smtpmail[3]. However, this assumes XD> one to put the access_token in place of `:secret' in the XD> auth-source file as Emacs uses password as the access_token in XD> both places. However, access_token expires quite frequently XD> (e.g. about 1 hour for Gmail) and without refreshing it XD> automatically it is practically impossible to use conveniently. XD> Hence the propose hack and the following suggestion. This isn't actually true. When I added the support many years ago, I updated auth-source so that the :secret field can be a function, and this is how you should be using the current xoauth support. On the bug thread I posted a suitable function that handles token refreshing (and its on my list of changes to emacs that I expect to push at some point). So everything necessary to use xoauth for nnimap and smtpmail with auth-source, including automatic token refreshing, is already present in emacs. Having said that, I think some of the ideas in Xiyue's code would be useful. However I think it would be best to base this on the existing code which works very well and is in use by at least me (and I think some others as well). Best, Andy -- Andrew Cohen