GNU bug report logs - #72992
29.4; towards xoauth2 support in Emacs

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: wishlist; Reported by: Xiyue Deng <manphiz@HIDDEN>; dated Tue, 3 Sep 2024 00:00:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 9 Nov 2024 20:02:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Nov 09 15:02:29 2024
Received: from localhost ([127.0.0.1]:54571 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1t9rfA-000510-PZ
	for submit <at> debbugs.gnu.org; Sat, 09 Nov 2024 15:02:29 -0500
Received: from mail-pl1-f179.google.com ([209.85.214.179]:46113)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1t9rf7-00050k-JQ
 for 72992 <at> debbugs.gnu.org; Sat, 09 Nov 2024 15:02:26 -0500
Received: by mail-pl1-f179.google.com with SMTP id
 d9443c01a7336-20cf3e36a76so34614375ad.0
 for <72992 <at> debbugs.gnu.org>; Sat, 09 Nov 2024 12:02:25 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1731182479; x=1731787279; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=S3GAou1LY2mhOSdxbL1fo1foLlxY9rO2P8Y/KPG1XWQ=;
 b=N7n5aLqcV5hFY7kfa+XTGNfS0LuMYy2fVhoUAokQzkWFAsBbEtzLEp0E0yX7zW2gTW
 6zHSQS7p303tb9ESBUnUV0u/8MYqJahrcf04r+KmU695V87Ybg68WPF/dOnXpr5UX4nA
 pbQOQXoEouJEGBZ1zKstvWFYgPX3N4qT61lblYmf3Biv6jrlRgUhMKIlTFkMVb6NFSFK
 Yei0AnRkP0sutwYmOZYNDB0ye1YuzjmBeRug6arDjqxNAEoficAWsx7I/uEP9m5wXgh8
 SbeQcpTuYqjDp3dVF5J9dAVHsgtOkrl3matIn2GhB7BpQhlYnDTopSmHEALDVpTpGye0
 EXjg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1731182479; x=1731787279;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=S3GAou1LY2mhOSdxbL1fo1foLlxY9rO2P8Y/KPG1XWQ=;
 b=S0HEVnunD0/tPrhSoRTZFuEZZQ2I4m+z4zsTqKlQhmNhRvmjV5cHFxj0pq/RA0KKTO
 5Xkq4iy/EYhizMudf3wcACKDWRpcM+L+gufKXOWLqiz7XuDD4rLu81pkJJ9aPf1J72B+
 iZLSPZrBVeJBRUa8SurCqTll2FjBWGUqTGswszkuT5HYRhqp4IPGYAcocrBYcT886Mdu
 gVBLcYqHAvtyNxtFNAuOuDqqd/WB5C3S2ca66Au3UMWZJ2zM3OT6OmPKMcnoH8OeMAMa
 uYKWE/if6hBAoF7QIWuWdnxlADbzrE5n7ZWqtWTXKnpLMiNiV1uEXaiFdxe+U6ik6aCG
 5+/w==
X-Forwarded-Encrypted: i=1;
 AJvYcCUdsAP6+FrhOBBOYg/g3tyY2sIAEyhYAC1KZOrUxUUxFPMX+6VSA9uFCB/yxoqVBys44u6dFA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwqjTlIslserSvwfml3JK39WQypCxqGBY00t8tVT1wBlbbhAaj3
 bOoQDx7SeNz0TD5FKd3vNebnl08wGAbVkqfdw2ubJZfCZT4ZVp02
X-Google-Smtp-Source: AGHT+IHTU4ofY5NtCbg2+bKZE/ucVggIPxIJ0cw+tDKI7avXv6v+qac+UDEQoyrGttAFsSZWDZ6jog==
X-Received: by 2002:a17:902:f70b:b0:20c:c482:1d66 with SMTP id
 d9443c01a7336-211835beeaemr103985645ad.35.1731182479394; 
 Sat, 09 Nov 2024 12:01:19 -0800 (PST)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-21177e68dfasm49642575ad.225.2024.11.09.12.01.18
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 09 Nov 2024 12:01:18 -0800 (PST)
From: Xiyue Deng <manphiz@HIDDEN>
To: Ted Zlatanov <tzz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <m2frp6ww7q.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN> <87wmio3j35.fsf@HIDDEN>
 <m2frp6ww7q.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sat, 09 Nov 2024 12:01:15 -0800
Message-ID: <87cyj4rxbo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/signed; boundary="=-=-=";
 micalg=pgp-sha512; protocol="application/pgp-signature"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--=-=-=
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

Hi Ted,

Ted Zlatanov <tzz@HIDDEN> writes:

> On Thu, 03 Oct 2024 15:41:34 -0700 Xiyue Deng <manphiz@HIDDEN> wrote:=
=20
>
> XD> Just want to follow up on this: may we try your fixes and maybe try to
> XD> contribute for committing upstream?  Also, for the :secret in closure=
s,
> XD> do you suggest to remove it or is there another up-to-date way to hide
> XD> it in memory?
>
> I think contributing the oauth2 support directly to Emacs is the best
> approach because it would help the greatest number of users without
> requiring extra configuration. I'd say modifying auth-source.el to fit
> the need is absolutely OK. I would just ask that if you modify the
> format of the authinfo file, to keep it compatible with JSON
> serialization for those of us that use an authinfo.json file.
>
> I'd prefer to find another way to hide the secrets if closures don't
> work anymore. I don't know if Emacs offers something; if not then we
> should make an effort to do it. But that effort should not block the
> oauth2 support, it's completely separate IMO.
>
> XD> Maybe auth-source source can host a helper function that checks
> XD> if `:secret' is not set and xaouth2 is preferred (e.g. `:auth'
> XD> is `xoauth2') and all required credentials are available it will
> XD> get the access_token and put it `:secret' (or basically my hacky
> XD> advice :)
>
> Sure, if that makes the code easier. I think the important thing is just
> to make it compatible with the current usage and to avoid making the
> user customize things to make oauth2 support Just Work.
>
> XD> In this regard, is it desirable to make `auth-source-search-backends'=
 a
> XD> defgeneric acting on a given protocol (basic vs. xoauth2 vs. others),
> XD> and similarly for `nnimap-login' et al.?
>
> I'm not sure if that would benefit the users. If it benefits the
> developers that's nice, but definitely not required, and especially if
> it changes the search API and can't be implemented in a compatible way.
> Because there may be a dozen packages on Github or whatever using that
> API, and updating all of them will be painful.
>
> Basically if the search API works right now, it's probably easier to
> leave it or make a new one and transition gradually.
>
> I hope this was helpful :)
>
> --=20
> Ted Zlatanov <tzz@HIDDEN>

It seems I completely missed your email, and sorry for that.  I think
your suggestions are very helpful: we should make oauth2 available for
auth-source while keeping the existing interface.  I think there are a
few more things to do before that can happen:

* Ship oauth2.el with Emacs, so that auth-source can make use of it.

* Decide which sequence of credentials to try before giving up and throw
an error.

I wonder how hard it would be to make these happen.  Since this thread
is already very long, I'll probably file new bugs for tracking.

Thanks again!

=2D-=20
Regards,
Xiyue Deng

--=-=-=
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQJGBAEBCgAwFiEEiKQfd6o81mjI+LWALell7WOCXJMFAmcvv4sSHG1hbnBoaXpA
Z21haWwuY29tAAoJEC3pZe1jglyTJwcP/i0gVQL3Sv/s1pTecQ8zczlUrVE2KloY
uuA1jch/KxBEzB9laFP6oA+2Es/esB/D/RSgzoUQj77q6t5Tr1IzHwQ2G4RyAkIq
jM+rWBAZrQfMXJBGGcevpmMp+CH9PTgGuyAgi2FFWchdwpp4ti/DFqLW66tsxR9E
NfZMWkMqop/OFEp0tsb+7meFZ2lT8V+0imowwJaNYQ1pQIlmmc0pKQAwZei9bJBO
b5ICDc3eEdrcE3hDrL8NAoabnO5doAuq0OcfFDdem+9w6pssUQadnARPpGOOmV3M
35TIVgTFW4J87Zy2G5Dl1PP0Mh8zL4+6MQoqusnJvkFMaVIco4L5uoix0ESWyqbf
+JrhGdpaWiX0iKCjgaWnZHtz4z5jYf+jIKyUv1yfRZd2XdgwGyC5yWvyokpyUfNT
8qsjtHRk/ia11IOWxSZSzH/JLGvB4DNJm34mRgQQwt574rNOA0X2ieAUFc3/f1er
LCALog6rSJdfF88yLAk+l8MWaRCvmAZyqKlETr7C7dWKJfMNn8RHEoy3ZfljdnBQ
dYJkEuJn9OaJkM3IzGhFgWhCBroLgmZgq73OsnixwiWCMAci65R9/CXKSlKdvmcv
aPUNUDTvoISsfBVF9kX29OmbK1LKANNo3uxaS2tvhZRdub84oQTno/+zw/1J/xRO
fsJF8RcUidyo
=uw4s
-----END PGP SIGNATURE-----
--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 8 Oct 2024 13:40:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Oct 08 09:40:07 2024
Received: from localhost ([127.0.0.1]:51721 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1syARb-0007Yx-0B
	for submit <at> debbugs.gnu.org; Tue, 08 Oct 2024 09:40:07 -0400
Received: from mail-qt1-f176.google.com ([209.85.160.176]:51472)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <tzz@HIDDEN>) id 1syARY-0007YK-TU
 for 72992 <at> debbugs.gnu.org; Tue, 08 Oct 2024 09:40:05 -0400
Received: by mail-qt1-f176.google.com with SMTP id
 d75a77b69052e-4582c62ee33so61539781cf.3
 for <72992 <at> debbugs.gnu.org>; Tue, 08 Oct 2024 06:39:56 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=lifelogs.com; s=google; t=1728394730; x=1728999530; darn=debbugs.gnu.org;
 h=mime-version:user-agent:message-id:date:references:organization
 :in-reply-to:subject:cc:to:from:from:to:cc:subject:date:message-id
 :reply-to; bh=j3gLcifHb8Kra9nAjGRPNTXn8YDA6q7WBklkhw2yshQ=;
 b=O9CRNK14C8Vx5OQB4KWiSiVf7pSd1jlKCcGddtBiu/l7Kg0WA+xc9eham8txIaeQrf
 J9PgOOZSJYj+XLTiCXNUoEWncJv7fCrc/wioZO88YHkW34vqduFVw1ZdNdhydh9nFGV3
 3yarGuLAute9yqUmtpCRyuG+A+SDtoxZFj38s=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1728394730; x=1728999530;
 h=mime-version:user-agent:message-id:date:references:organization
 :in-reply-to:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=j3gLcifHb8Kra9nAjGRPNTXn8YDA6q7WBklkhw2yshQ=;
 b=RFXBY3UJgSlDJlDSRICrSkIUpt+nhk+2l4qacfwr2cyZSScLswLIp0ZElVe03qIIXZ
 WbA/P7mGZZj5Mv+tmigfRrjGhUlTUip30KZiJx12j5YmN/18MZwG2E1cxRfSXMBZtBdI
 ntIcj+Axy+AlZuHt64A63dLw1qDYu4vuxmUtMuzJTRWfaI/ZGF2XbOeIH7uPu8nOJhXM
 uXdUuECj9smISXvT3JGUAKFWxWMUGclH2BbOPoL6t2stXz3EEX4yqjoizTBxHH4vIrHd
 wrH6CD5B5uGK7htA2LcEHt70XpPIKVxanjJPpXLGW8uUtAhfUZHX3XFypLDh/TI+KiDq
 vwug==
X-Forwarded-Encrypted: i=1;
 AJvYcCXnz5caL74bG32Lf8Cgk97+UaiaFvP7RsupKv0ChT9dQNjRbJ26zx8sXqrHDb3A6aRHMB+8eQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzZnLHbnHLSN2inWN4eov2Bluc5lYklGJfj8Ba0eH6M3dvj4gM0
 AFOCBbpBlprJs/M0C8cnHnGH/ObVFJIULXgH6aN0v7JJDc/DuPGCNDtDQeqL5NU=
X-Google-Smtp-Source: AGHT+IGGPcq+hemC/znKa0pZ8Awcn0+YtGS8gSTh5cWC3pQNG0BqjlWsGVFQBSsBYD+dj/dylxhK1Q==
X-Received: by 2002:ac8:5d42:0:b0:458:5d27:8527 with SMTP id
 d75a77b69052e-45d9bb299aemr204193541cf.51.1728394730436; 
 Tue, 08 Oct 2024 06:38:50 -0700 (PDT)
Received: from foxy.local (pool-98-110-159-197.bstnma.fios.verizon.net.
 [98.110.159.197]) by smtp.gmail.com with ESMTPSA id
 d75a77b69052e-45da74b457csm36221581cf.13.2024.10.08.06.38.49
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 08 Oct 2024 06:38:50 -0700 (PDT)
From: Ted Zlatanov <tzz@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87wmio3j35.fsf@HIDDEN> (Xiyue Deng's message of "Thu,
 03 Oct 2024 15:41:34 -0700")
Organization: =?utf-8?B?0KLQtdC+0LTQvtGAINCX0LvQsNGC0LDQvdC+0LI=?= @ Cienfuegos
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN> <87wmio3j35.fsf@HIDDEN>
X-Face: bd.DQ~'29fIs`T_%O%C\g%6jW)yi[zuz6;
 d4V0`@y-~$#3P_Ng{@m+e4o<4P'#(_GJQ%TT=
 D}[Ep*b!\e,fBZ'j_+#"Ps?s2!4H2-Y"sx"
Date: Tue, 08 Oct 2024 09:38:49 -0400
Message-ID: <m2frp6ww7q.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On Thu, 03 Oct 2024 15:41:34 -0700 Xiyue Deng <manphiz@HIDDEN> wrote: 

XD> Just want to follow up on this: may we try your fixes and maybe try to
XD> contribute for committing upstream?  Also, for the :secret in closures,
XD> do you suggest to remove it or is there another up-to-date way to hide
XD> it in memory?

I think contributing the oauth2 support directly to Emacs is the best
approach because it would help the greatest number of users without
requiring extra configuration. I'd say modifying auth-source.el to fit
the need is absolutely OK. I would just ask that if you modify the
format of the authinfo file, to keep it compatible with JSON
serialization for those of us that use an authinfo.json file.

I'd prefer to find another way to hide the secrets if closures don't
work anymore. I don't know if Emacs offers something; if not then we
should make an effort to do it. But that effort should not block the
oauth2 support, it's completely separate IMO.

XD> Maybe auth-source source can host a helper function that checks
XD> if `:secret' is not set and xaouth2 is preferred (e.g. `:auth'
XD> is `xoauth2') and all required credentials are available it will
XD> get the access_token and put it `:secret' (or basically my hacky
XD> advice :)

Sure, if that makes the code easier. I think the important thing is just
to make it compatible with the current usage and to avoid making the
user customize things to make oauth2 support Just Work.

XD> In this regard, is it desirable to make `auth-source-search-backends' a
XD> defgeneric acting on a given protocol (basic vs. xoauth2 vs. others),
XD> and similarly for `nnimap-login' et al.?

I'm not sure if that would benefit the users. If it benefits the
developers that's nice, but definitely not required, and especially if
it changes the search API and can't be implemented in a compatible way.
Because there may be a dozen packages on Github or whatever using that
API, and updating all of them will be painful.

Basically if the search API works right now, it's probably easier to
leave it or make a new one and transition gradually.

I hope this was helpful :)

-- 
Ted Zlatanov <tzz@HIDDEN>




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 3 Oct 2024 22:42:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 03 18:42:44 2024
Received: from localhost ([127.0.0.1]:34063 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1swUWx-0000OX-RL
	for submit <at> debbugs.gnu.org; Thu, 03 Oct 2024 18:42:44 -0400
Received: from mail-pl1-f182.google.com ([209.85.214.182]:56331)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1swUWv-0000OL-4M
 for 72992 <at> debbugs.gnu.org; Thu, 03 Oct 2024 18:42:42 -0400
Received: by mail-pl1-f182.google.com with SMTP id
 d9443c01a7336-20bc506347dso12951185ad.0
 for <72992 <at> debbugs.gnu.org>; Thu, 03 Oct 2024 15:42:38 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727995298; x=1728600098; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=rpElN9scKlZZDXOEBAnJKf/U7Vocz6/v9fDts9akSgc=;
 b=IuQewmjafgPjz705f0p7Lbxxi3pb62hwrm6mS3gHyEVfiZu36HAJjFQUZ+XEO0Kn0G
 KCw/TTbumvmUayHr9OAndgaicezP3wdA/dlxaZTS9Yu3CVEBa7Drl2EbOQ0j6sHvpglY
 fNc6hCXPov3qrNENPwl/mS9J+CFqDRZ1HNs7Fa3+cv97sPcWYx07v6yheXNz/UbDygzN
 7uMldey9ZSCsu6mG/6Oo+Bpe3jT4mzxBjU3jXEW+A8TBRRpKFd2j37MvJtU/QY2EEf+n
 /qh27w8GB+4O4FGBg/70DxX/hzMmBG4apY3j/IYL2VaZH6N28HeDdxfsl0YhnXLuZtmz
 nz5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727995298; x=1728600098;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=rpElN9scKlZZDXOEBAnJKf/U7Vocz6/v9fDts9akSgc=;
 b=hVlb27lDk+dkOTMk6T3gBgvPjZ5KFFfxtX6ueIYAXnt9XVlJ9kWSzTkpXDabzlK2RF
 7Z8xRtfxhbOPjQFDFi9AQAzKb9LNwuUmnTuYJD2KZLC3nno5dhZTFbr4EsexTbh8Rbpp
 XQFScTLBp8ufDo8rYf7Q2hwUxfrLcNt1kDGve5fYi6VanxEmEDMblft0SERXBkGWOE9e
 pkpZhJwFdzcS1if2pXU2Y65SLwLdlNGdoIBmV5ZyE+fsA6NLnQKMCfGA3TPVUJcBshbH
 gdj6gXf1/WZCxbknsDE1pDgvQlwTEs2CVbbhpJAeScHOBWHv7l5VLq8BD12wsWjrUjbn
 uDVg==
X-Forwarded-Encrypted: i=1;
 AJvYcCWrOIWM0FacqxKmwZ+RkU4WkLRRGB01GZsSPXCeZWX66nUYPwzY/Hcwazug8Zgep4Hh9RKn4w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwbLCWf+jcvSiumwtTxMJApmUYvwz2CH13TKGZ+ZCl4T9wgeSv7
 lC7583+cc/L3AckOwFIHhP35hGv59K240to496n8XlYfG+RsBeY7
X-Google-Smtp-Source: AGHT+IGUu5KRilK396Wc/wiX8w4HPKX76FY03UJGHL4mb1v/HUwLiZ/BLpP3BDjdQppwJxEIGlG7vQ==
X-Received: by 2002:a17:903:22cf:b0:202:26d:146c with SMTP id
 d9443c01a7336-20bfdf803dcmr10842475ad.5.1727995297567; 
 Thu, 03 Oct 2024 15:41:37 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20bef7074fesm13627735ad.250.2024.10.03.15.41.36
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 03 Oct 2024 15:41:37 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <878qvnmfrp.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Thu, 03 Oct 2024 15:41:34 -0700
Message-ID: <87wmio3j35.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Xiyue Deng <manphiz@HIDDEN> writes:

> Andrew Cohen <acohen@HIDDEN> writes:
>
> [...]
>
>> By the way there are some significant bugs in auth-source.el which I
>> have fixed in my personal tree but haven't yet pushed. I have so little
>> time for emacs at the moment, but I'll try to get around to it. And
>> there is one major deficiency in auth-source.el that I want to deal
>> with: obfuscation of the :secret. When Ted originally wrote
>> auth-source.el he wrapped the :secret in a closure so that the secret
>> itself wasn't visible in memory. At the time he did this, closures
>> weren't fully part of emacs, and their implementation at the time didn't
>> expose the contents of the closure in bytecode. But the current official
>> implementation does, so this obfuscation trick no longer works. I want
>> to remove it since it no longer works and might lead to confusion. 
>>
>
> Looking forward to it!
>

Just want to follow up on this: may we try your fixes and maybe try to
contribute for committing upstream?  Also, for the :secret in closures,
do you suggest to remove it or is there another up-to-date way to hide
it in memory?

>>     XD> Maybe auth-source source can host a helper function that checks
>>     XD> if `:secret' is not set and xaouth2 is preferred (e.g. `:auth'
>>     XD> is `xoauth2') and all required credentials are available it will
>>     XD> get the access_token and put it `:secret' (or basically my hacky
>>     XD> advice :)
>>
>> I think this isn't the right way to go. Currently xoauth2 is one of
>> several supported SASL methods.  The logic is supposed to be to try them
>> in a certain order, but this hasn't worked properly for some
>> time. Nobody has noticed since almost everyone uses only the basic
>> method. In gnus there has always been a server variable,
>> nnimap-authenticator, that chooses the preferred sasl method, which is
>> how the current support for xaouth2 is designed to work.  I think this
>> is the right way to handle this (rather than relying on some specific
>> form of the auth-source entry) but it would be good to fix the logic in
>> nnimap.el to allow multiple methods to be tried.
>>
>
> Right.  The `:auth' trick I did is just to workaround the restriction
> that `nnimap-login' chooses basic method over other methods, and I'd
> prefer a better built-in support in auth-source myself.  As you
> mentioned, maybe it can be remodeled after `smtpmail-try-auth-method' to
> so that the login method is chosen on demand instead of trial-and-error.
>

In this regard, is it desirable to make `auth-source-search-backends' a
defgeneric acting on a given protocol (basic vs. xoauth2 vs. others),
and similarly for `nnimap-login' et al.?

>> [...]
>>

-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 23 Sep 2024 06:41:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 23 02:41:35 2024
Received: from localhost ([127.0.0.1]:43096 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssclK-0000J9-Va
	for submit <at> debbugs.gnu.org; Mon, 23 Sep 2024 02:41:35 -0400
Received: from mail-pg1-f173.google.com ([209.85.215.173]:53731)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssclI-0000Iq-CZ
 for 72992 <at> debbugs.gnu.org; Mon, 23 Sep 2024 02:41:33 -0400
Received: by mail-pg1-f173.google.com with SMTP id
 41be03b00d2f7-7db174f9050so706058a12.3
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 23:41:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727073603; x=1727678403; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=Swqk7YvG3m5qqAuH2faG+v8+zJwRkekLq4mNCD4wdUw=;
 b=Om/GKDNCZd2ybIgDOOhFSmdU/YenqFg4Telp9+CVy6bU63BfEvpKgfnhccWFfYqaDL
 pn9BqJJYQ0OwxGKLcG73S5rTErt01XkeQ0NQAbtsGbLnQ7B+eiJjfHG3Ey97kAZ+aCFj
 CR8SsmjCSljVxz+qhyHzqcQR7QgUKb6h0A0jOUfqOcmacMv2zZcYghTXWuHnlN5g4Fxr
 JTBFCS5MJqKHSmzlLT1szLFQT7VSFlCcHJMVa27FTDndte+Jm0uOCag9G9/oa6wRUbxa
 hNWq4Hrssft+XB4DisCg9a7Agrc9ZreoNsL8yYdwLnxs3RHd99hTUrIP/qEG27VpXMDo
 C9Xw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727073603; x=1727678403;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Swqk7YvG3m5qqAuH2faG+v8+zJwRkekLq4mNCD4wdUw=;
 b=lPDLeXRw4iNwpdQ0OGkDMdbRpXvRz+Xcwd4amuCjQHXW9jod3OBo1Zq0VIZDddmVvs
 VBO9371+4vvouY6rsKUJUuJY4Tp11pxEa6+45XxNe2U0TdeA2+gS+A7Qijbt9kWVeJLK
 jeT92wql44YkGzPsonS9t1V2GIUvZEsLT5fkaxMXsFUhbXoIol1oqRSVPXTKjXSJVAFT
 Wza74KYBEcjeL8OObgj0+M8todUiaTMVSre5LsGGCVOCbJdoqJQdAif3HKVLEyhindER
 MHtPixsxduitfd2KsHjxMT4e35jUknWHi4TPQQALZPt3bxf/widim/qk+lQBh9Z59pBw
 mK2g==
X-Gm-Message-State: AOJu0Yzf2gKSl31Nj0AavXctitfMiCiq6+6ZSGGbgwg8eVMz0onq/N0u
 468Vcc+zMPH1L/8kHxR1602W9RR+SOUn1d8NCwfghJZvRXSzIH4lg320sw==
X-Google-Smtp-Source: AGHT+IGPSNUiksMpVlGRPw/zaqDZc9EGp+Pdl828nO8bfBIDKlFMbOhYb2z4oSKwYQ0CLOHKZDWKIQ==
X-Received: by 2002:a17:90b:3b8f:b0:2d8:8430:8a91 with SMTP id
 98e67ed59e1d1-2dd7f3cc3f4mr14419421a91.10.1727073603464; 
 Sun, 22 Sep 2024 23:40:03 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2dd52e2eb85sm12197813a91.1.2024.09.22.23.40.02
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 23:40:02 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87tte67v1v.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN> <87o74ldpby.fsf@HIDDEN>
 <87sets416y.fsf@HIDDEN> <87tte89gmn.fsf@HIDDEN>
 <87ikun4ade.fsf@HIDDEN> <87tte67v1v.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 23:39:59 -0700
Message-ID: <87cyku50w0.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>
> [...]
>
>>> diff --git a/auth-source-xoauth2-plugin.el b/auth-source-xoauth2-plugin.el
>>> index cdcc9e7..caf5baf 100644
>>> --- a/auth-source-xoauth2-plugin.el
>>> +++ b/auth-source-xoauth2-plugin.el
>>> @@ -41,7 +41,7 @@
>>>  ;; or with use-package:
>>>  
>>>  ;;     (use-package auth-source-xoauth2-plugin
>>> -;;       :config
>>> +;;       :custom
>>>  ;;       (auth-source-xoauth2-plugin-mode t))
>>>
>>
>> Quick question: I wonder whether customizing the minor mode variable is
>> preferred over toggling through the minor mode function?  (I assume both
>> will run the minor mode body.)
>
> You are right, it doesn't matter.  I changed this when adding the
> autoload cookie, and somehow I had convinced myself that this would only
> work as a user option, which of course is not the case.

Thanks for confirming!  I have incorporated your suggestions and pushed
to my repo.  Thanks again for your review!

>
> [...]
>
>
> -- 
> 	Philip Kaludercic on siskin

-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 23 Sep 2024 06:18:23 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 23 02:18:23 2024
Received: from localhost ([127.0.0.1]:43077 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sscOs-0007Qe-Mb
	for submit <at> debbugs.gnu.org; Mon, 23 Sep 2024 02:18:22 -0400
Received: from mout02.posteo.de ([185.67.36.66]:53835)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1sscOq-0007QN-8g
 for 72992 <at> debbugs.gnu.org; Mon, 23 Sep 2024 02:18:21 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id B8BF4240103
 for <72992 <at> debbugs.gnu.org>; Mon, 23 Sep 2024 08:17:50 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1727072270; bh=oTlV6dCQ+ntz7Kwu1oXsN2PL5MtfR3FoBPSDeE+Ht6M=;
 h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=QZxGuEw7H/mtobm4tQqEDhTT1H3gizDQgiUenclJnvl3WOnwKMKn6HrSXNWQGpG2p
 Ld1faD1KqDDM7JCv5GLm/fZVu3p3yebaoRClQZlxzt/mKCQIMwQul7OwKtStUIvlJ6
 WsIpMpXMYK8ibd2To6poZ88yJHmY71fyuURuup3zshcJW4gB6j6CpT/YTLVHl4oq5k
 4W4kyesoIdXxejNK2xR6nuBZN5F8PwM5oc/YLdv4lKcu5IbAT2EgkNj+GV3SYxkKB/
 ANVl6y3bVZ4Sgrkwfj2st0FXuGjavdKU5ll+QOUc+MNYUV/ZCKvd2Xh/c9Afa6JbsM
 UdqX+rDHhFMYA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4XBt8F6ymGz9rxK;
 Mon, 23 Sep 2024 08:17:48 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87ikun4ade.fsf@HIDDEN> (Xiyue Deng's message of "Sun,
 22 Sep 2024 15:00:29 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN> <87o74ldpby.fsf@HIDDEN>
 <87sets416y.fsf@HIDDEN> <87tte89gmn.fsf@HIDDEN>
 <87ikun4ade.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66;
 url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66";
 preference=signencrypt
Date: Mon, 23 Sep 2024 06:17:48 +0000
Message-ID: <87tte67v1v.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Xiyue Deng <manphiz@HIDDEN> writes:


[...]

>> diff --git a/auth-source-xoauth2-plugin.el b/auth-source-xoauth2-plugin.el
>> index cdcc9e7..caf5baf 100644
>> --- a/auth-source-xoauth2-plugin.el
>> +++ b/auth-source-xoauth2-plugin.el
>> @@ -41,7 +41,7 @@
>>  ;; or with use-package:
>>  
>>  ;;     (use-package auth-source-xoauth2-plugin
>> -;;       :config
>> +;;       :custom
>>  ;;       (auth-source-xoauth2-plugin-mode t))
>>
>
> Quick question: I wonder whether customizing the minor mode variable is
> preferred over toggling through the minor mode function?  (I assume both
> will run the minor mode body.)

You are right, it doesn't matter.  I changed this when adding the
autoload cookie, and somehow I had convinced myself that this would only
work as a user option, which of course is not the case.

[...]


-- 
	Philip Kaludercic on siskin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 23 Sep 2024 02:21:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 22:21:55 2024
Received: from localhost ([127.0.0.1]:43007 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssYi3-000398-23
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 22:21:55 -0400
Received: from mail-pl1-f170.google.com ([209.85.214.170]:59765)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssYhy-00038j-Va
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 22:21:54 -0400
Received: by mail-pl1-f170.google.com with SMTP id
 d9443c01a7336-208cf673b8dso37310105ad.3
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 19:21:28 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727058022; x=1727662822; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=SqMJrm9XfgR4AMlGJXgC8Liqry/2HS5Si9MMvL6h3PE=;
 b=N6eHrFvY7EYg2SceeuBpSsD//sRNWQdgJoKObuq4wI3XkAxRACUQxEDigoFIDvj3xG
 Yq4v9nCr8IBiLvQx8+jdBBj3ksv5CXlXF+FLHzoJ+o2MnI8JH6Ugb6xzlxzJ4+9qFjyt
 TLDcAj9DZ8l8JSC4n02RQSZawO47ZmJ8+rm/6muyEec79o0SJzZ4NuWTIkZAsvR2houJ
 vbRPR6n8LDGEw4BIxI77vybGSXDsSbdhGuY3bGr7PLg39u/he2RIjrmtIsTso7I8AyL1
 d0XY/kzzBrqtsBOJSR7AdTwfyU9lGVrM76J9scbQEstncOjLutg5MmeusC3OBBusnOeJ
 r7ZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727058022; x=1727662822;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=SqMJrm9XfgR4AMlGJXgC8Liqry/2HS5Si9MMvL6h3PE=;
 b=TG2MUFMRWN5rWxqXb+TaUyUIb8wR2GceBqIBQX4ZKApAiOnSkTuxVetFA3ZkC9BhYq
 mIu2Z9p7kyYrblDWJSqFYU1+mJg2q04PPt9ByAZhQgpJac4VCJlKGc8Cg/t2lAtOlhro
 ZNLU4+SXq6ps70bf+mvu6Fe0gCIhqSwuqfwh6lM9PKDhozSwBQPrGFCnOUSnyLyKm17P
 xSBY0LhrZ1GjFtjGfe+OY6HOApm7HJQfgA/YGnStTa4cF9qMJM8Ujk5F5boz7VECBPc5
 qTcyE9IUyTeX6gJawzPqr43g2W4CxYP1ZdGJI3vZr0631JpcXNw/v9KD/0LnobaCzYoL
 QLEQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCVlYhSxlig7jfH6zoyDwmN05Ncwn/kuYZvfxkj0xVeKnQY324B+vJqSRxeTvmNc/ymC9fpF8w==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yxhih13Un8i9DgYxW29X3XtHHxBrz4bvFrFWeNUgikOwMK6yy2I
 H0di7hkzL8w9WpOei9A3JEu7NnXKbK5iLpkWh83NliaHpDVXMC9w
X-Google-Smtp-Source: AGHT+IHhRhTQSQHJg87cyb5ZVDBD4k3CPl4HNUyJSncZlybWxYz9HbQMTnfB42BscAAHIZWadWYAmQ==
X-Received: by 2002:a17:902:e745:b0:205:63c5:74e1 with SMTP id
 d9443c01a7336-208d97e3f52mr156039425ad.5.1727058022398; 
 Sun, 22 Sep 2024 19:20:22 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-207945da7b8sm124666065ad.16.2024.09.22.19.20.21
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 19:20:22 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <66f0ad4f.500a0220.10c3c2.dde8SMTPIN_ADDED_BROKEN@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN>
 <66f00802.050a0220.988f0.9640SMTPIN_ADDED_BROKEN@HIDDEN>
 <87msjz4bb3.fsf@HIDDEN>
 <66f0ad4f.500a0220.10c3c2.dde8SMTPIN_ADDED_BROKEN@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 19:20:19 -0700
Message-ID: <87frpr3ycc.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Ted Zlatanov <tzz@HIDDEN>,
 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Bj=C3=B6rn Bidar <bjorn.bidar@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>> Hi Bj=C3=B6rn,
>>
>> Bj=C3=B6rn Bidar <bjorn.bidar@HIDDEN> writes:
>>
>>> Xiyue Deng <manphiz@HIDDEN> writes:
>>>
>>>>> [...]
>>>>>
>>>>>     XD> P.S. Is your set up mentioned in Bug#72358 still working for
>>>>>     XD> outlook.com emails?  After reaching out to an MS representati=
ve
>>>>>     XD> they mentioned that token refresh was disabled[3] for
>>>>>     XD> outlook.com so I just gave up.  Maybe it still works for Outl=
ook
>>>>>     XD> Org emails?
>>>>>
>>>>> Yes, it still works perfectly. I suspect that the information they ga=
ve
>>>>> you isn't fully accurate :)
>>>>
>>>> Thanks for confirming!  I'll follow-up in private to try to figure this
>>>> out if you don't mind.
>>>
>>> Could you update me on this please too?
>>> We have an issue with this at work.
>>
>> I have reached out to Andrew offline and confirmed Andrew was using a
>> corp account, so there might be some corp administration settings that
>> enables the refreshing of access_token.  It seems to me that this is
>> still not possible for personal outlook.com accounts.
>
> That matches my personal experience. Cooperate accounts are not on
> Outlook.com or are they?
>

AIUI corp accounts usually have their own domain names, just the email
system is operated by Outlook.

> To bad I hope there would be some change, maybe someone should reach out
> to the EU or so.

OTOH, registered applications (e.g. thunderbird) can still login
outlook.com emails through OAuth2, which also have full support for 2FA.
Might worth taking a look at how they are doing it.

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 23:51:05 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 19:51:05 2024
Received: from localhost ([127.0.0.1]:42988 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssWM5-0003sb-D8
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 19:51:05 -0400
Received: from thaodan.de ([185.216.177.71]:46360)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjorn.bidar@HIDDEN>) id 1ssWM2-0003sA-9y
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 19:51:04 -0400
Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154])
 by thaodan.de (Postfix) with ESMTPSA id 7A2D5D00050;
 Mon, 23 Sep 2024 02:50:38 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail;
 t=1727049038; bh=TV+jbT/ORfJZJz+PUEKEdA76G04G8tHoZ6T+LASFVW8=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=rDNCcKsG3H1Or7j7wkj0KwtQPHsYyWbktSTyDksrJNDvtC//O2pQoUIxHf9yJldqX
 oZfmY35MHPxJXvAWSldei1f10aUNUVuloX7mu/qRvY38SyyTrXKG8eswYKHvs2jxLa
 6CF1c5BQN7AEkkrt6aHl0HRF+S6O4+CCvw+6r3wp+5/CleiwUb16zdVJhzgXLsyG3A
 2wLCeOVRAlUrFOVoATJVrl397tEBy0XcBlwychTJAn93obWnOS46bJtUPIqg7zyYKV
 bz3L5X32MPBbrgbcnWas5d8E3WO+uiu2M3Rac6RDVIJZ44uiPr8wX2f/yqeel9WaxS
 dFx7cL+7cvp8zawpVgSeGO4Cgn+ze5du2LbGhuB34ea+XetYB79uuEJ8zGaoDruUhq
 GGussIjpEW2VMlra5ww+i5yFqTAi08Wm+wIhkFwrMRG0h0ofFBARRxaRLBEX5hrw5I
 oZkdmSa2gU8Y+88w2dHP/AR2cS1BI0Jdxz3dS1rw3LigimPbw2/asYdCUA6fGvmlnG
 YfUuxJO5kwMys1EyeRfhkAUWCl/l2zoSwKMDAVckP16bJnwDCCqPsUmxmbIfz9nHkc
 iyZ/Ig0jVEQbDOhroE+g5oHwkkHVWaegqcmn2M5O7obFp71iDYnKoQHeRLqwkLcVOa
 sNTcqWeS6/lTpUDecT/kP+Fk=
From: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87msjz4bb3.fsf@HIDDEN> (Xiyue Deng's message of "Sun,
 22 Sep 2024 14:40:16 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN>
 <66f00802.050a0220.988f0.9640SMTPIN_ADDED_BROKEN@HIDDEN>
 <87msjz4bb3.fsf@HIDDEN>
Autocrypt: addr=bjorn.bidar@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq
 w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV
 CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl
 HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8
 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF
 CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h
 K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2
 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC
 HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN
 XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg
 gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL
 AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E
 TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB
 B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe
 pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO
 HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG
 AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr
 dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n
 KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy
 GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK
 S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA==
Date: Mon, 23 Sep 2024 02:50:37 +0300
Message-ID: <87a5fzqmcy.fsf@>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 
 Content preview:  Xiyue Deng <manphiz@HIDDEN> writes: > Hi Björn, > > Björn
    Bidar <bjorn.bidar@HIDDEN> writes: > >> Xiyue Deng <manphiz@HIDDEN>
    writes: >> >>>> [...] >>>> >>>> XD> P.S. Is your set up mentioned in Bug#72358
    still working for >>>> [...] 
 
 Content analysis details:   (1.2 points, 10.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
  1.2 INVALID_MSGID          Message-Id is not valid, according to RFC 2822
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Ted Zlatanov <tzz@HIDDEN>,
 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Xiyue Deng <manphiz@HIDDEN> writes:

> Hi Bj=C3=B6rn,
>
> Bj=C3=B6rn Bidar <bjorn.bidar@HIDDEN> writes:
>
>> Xiyue Deng <manphiz@HIDDEN> writes:
>>
>>>> [...]
>>>>
>>>>     XD> P.S. Is your set up mentioned in Bug#72358 still working for
>>>>     XD> outlook.com emails?  After reaching out to an MS representative
>>>>     XD> they mentioned that token refresh was disabled[3] for
>>>>     XD> outlook.com so I just gave up.  Maybe it still works for Outlo=
ok
>>>>     XD> Org emails?
>>>>
>>>> Yes, it still works perfectly. I suspect that the information they gave
>>>> you isn't fully accurate :)
>>>
>>> Thanks for confirming!  I'll follow-up in private to try to figure this
>>> out if you don't mind.
>>
>> Could you update me on this please too?
>> We have an issue with this at work.
>
> I have reached out to Andrew offline and confirmed Andrew was using a
> corp account, so there might be some corp administration settings that
> enables the refreshing of access_token.  It seems to me that this is
> still not possible for personal outlook.com accounts.

That matches my personal experience. Cooperate accounts are not on
Outlook.com or are they?

To bad I hope there would be some change, maybe someone should reach out
to the EU or so.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 22:02:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 18:02:03 2024
Received: from localhost ([127.0.0.1]:42868 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssUeY-0005Nc-Vp
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 18:02:03 -0400
Received: from mail-pl1-f177.google.com ([209.85.214.177]:55339)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssUeV-0005My-OX
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 18:02:02 -0400
Received: by mail-pl1-f177.google.com with SMTP id
 d9443c01a7336-20551e2f1f8so42914185ad.2
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 15:01:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727042432; x=1727647232; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nQ1BKqPuq58NZdQuHiYZf6Pq9eNhQ0dSBFI/fEM316Y=;
 b=Rb+jyzVa96APCYdQxUp4vPBCPlSj2kTimty5kPc2k510xHTpvgsEzEhQV0zRvE3QEd
 USG/Rx+FFoidGnl8fu/XUy4KWWcO3TaZd0pM3/H6ZpokqS3P9xbLM1m0/M0UoGrL80Dh
 PTmiMW0iX4vSXriOP9O3OGEF6W/OnLSZYs6cm74M3W4nOffg9dNa41GteIC+L9Soqemh
 OkO1RVdT4pzI0zz3N5E/D7Btf50rJLhgHXjCKHXWyYvvhAhoS6zGLg9iBCalAxJ1ZljK
 +fVXVdQPeMsszV65hM+X8D79roZUG55egyz3CI1xNNgnPEESFq6X7kG6VGnKbVpRCVaP
 Ld1Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727042432; x=1727647232;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=nQ1BKqPuq58NZdQuHiYZf6Pq9eNhQ0dSBFI/fEM316Y=;
 b=BpfMgqXvuJNjWxemHs0z2jw4zqBXBEBlQUcAGca0UplWT+cMvZdYRErYxXb3+MquU4
 dHaiM820p3zXMGC+n4q+kaMWYbtIbddoyDJt+ccoaJgIaRwBrH4DqPZhPKHQeOIHmrir
 fkXbXpqlNgY/CDIb/eYxr8Eej5KLYkitVbY2ty+ls3fcLH4UzZFVT+MKFl9u8TxROuG8
 udpMLW28Ib0vsyoR0gRj17sczweg4QvZ+LdXQ8B+QDpDOdzkR1Rf7YwV1XFL13ynLQ6Q
 pvhITtRDXaYqpmYQz+IraC3EQZBzgHJRUT7hN/V8dcMZ4bRP1gi3ETWA3Eo8fpO6HKOi
 LaoA==
X-Gm-Message-State: AOJu0Ywz70X6HgTXqhdsP4ERIHrbOHXMPxjJxQ2o1y8aIpPcXVnYhGYU
 v8cSTnyQliu+ruk0H5WfqZJ5LC83ed3vJbgWC3RO1ZWmLiMVdfOtjO0F6CIw
X-Google-Smtp-Source: AGHT+IFqR1Hx0Ek4tm1KYwpPdrC0G2MF1L60gbxoxBFbFB2elX4TNcnj7fBBB4VkeJKqVTqMPT+3Aw==
X-Received: by 2002:a17:902:da8c:b0:206:c486:4c4c with SMTP id
 d9443c01a7336-208d8415d4dmr161401515ad.57.1727042431321; 
 Sun, 22 Sep 2024 15:00:31 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-207945da67asm123446135ad.4.2024.09.22.15.00.30
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 15:00:30 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87tte89gmn.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN> <87o74ldpby.fsf@HIDDEN>
 <87sets416y.fsf@HIDDEN> <87tte89gmn.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 15:00:29 -0700
Message-ID: <87ikun4ade.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>> Hi Philip,
>>
>> Philip Kaludercic <philipk@HIDDEN> writes:
>>
>>> Xiyue Deng <manphiz@HIDDEN> writes:
>>>
>>>> Philip Kaludercic <philipk@HIDDEN> writes:
>>>>
>>>>> Xiyue Deng <manphiz@HIDDEN> writes:
>>>>>
>>>>>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>>>>>> auth-sources that enables oauth2 handling which you can find on
>>>>>> Gitlab[1] (also attached).
>>>>>
>>>>> Once again I just want to be sure: When you say "plugin", you mean
>>>>> package, right?
>>>>
>>>> Yes, though it's not really an independent package but a "plugin" for
>>>> auth-source, a.k.a. a hack (the advice) to make auth-source to work wi=
th
>>>> xoauth2.
>>>
>>> Just to clarify: When I say package, I mean something to add to ELPA.
>>>
>>
>> Ah in that regard yes.
>>
>>>>> You are proposing to add this to GNU ELPA?
>>>>
>>>> Actually I would like to see which of my proposed changes to auth-sour=
ce
>>>> is acceptable and update auth-source in core accordingly.=20=20
>>>
>>> Sure it's acceptable, but in that case it would better to submit a patch
>>> modifying. auth-source.el
>>>
>>>>                                                            I think
>>>> Stefan's reply gave some suggestions in this regard and I'll follow-up
>>>> in a reply there.=20=20
>>>
>>> I just want to second Stefan's point that some clarification as to what
>>> xoauth2 is.
>>>
>>
>> Updated the comments section with this info.
>
> Great, that explains it well!
>
>>>>                    Meanwhile, it may still worth adding this package
>>>> to ELPA to support older Emacs versions if desired.
>>>
>>> In that case it might be better not to merge your changes into
>>> auth-source.el directly, as that would make it more difficult to
>>> automatically pull your changes out of the core to ELPA.
>>>
>>> An alternative is that ELPA mirrors your repository, and then we
>>> manually synchronise the changes into the core, whenever there is a new
>>> release.
>>>
>>
>> I was thinking making it only for Emacs <30 if the auth-source side
>> changes are upstreamed for 31.  Similar to "docker-tramp" which is only
>> for EMacs <28.
>
> The issue here is that tramp is developed outside of Emacs and
> synchronised manually back into the core/automatically on ELPA, while
> auth-source is currently only in the core and not distributed on ELPA.
> If this remains a separate file, we could easily add it to ELPA, but I
> don't know what the preference is there.
>
>>>
>>> [...]
>>>
>>>>>>         (let ((auth (plist-get auth-data :auth)))
>>>>>>           (when (and auth
>>>>>>                      (stringp auth)
>>>>>>                      (string=3D auth "xoauth2"))
>>>>>
>>>>> You can simplify the check by just doing (equal auth "xoauth2"), as t=
his
>>>>> implies all of the above (if it is `equal' to a string, it must be a
>>>>> string and hence also non-nil).
>>>>>
>>>>
>>>> Done.  Nice tip!  Coming from strong-typed languages I always want to =
do
>>>> type-checks first in fear of any aborting error :)
>>>
>>> If you want strong typing, then string=3D is the right thing to use,
>>> because if you want to assume that auth is always a string, then an
>>> error will be signalled.  That being said, if auth has the type "Maybe
>>> String", then checking the values explicitly or implicitly using equal
>>> is the right approach.
>>>
>>
>> Ack.  Thanks for the tip!
>>
>>>
>>> [...]
>>>
>>>>>>               (auth-source-do-trivia "Using oauth2 to auth and store=
 token...")
>>>>>>               (let ((token (oauth2-auth-and-store
>>>>>>                             auth-url token-url scope client-id clien=
t-secret
>>>>>>                             redirect-uri state)))
>>>>>>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-str=
ing token))
>>>>>>                 (auth-source-do-trivia "Refreshing token...")
>>>>>>                 (oauth2-refresh-access token)
>>>>>>                 (auth-source-do-trivia "oauth2 token after refresh: =
%s"
>>>>>>                                        (pp-to-string token))
>>>>>>                 (let ((access-token (oauth2-token-access-token token=
)))
>>>>>>                   (auth-source-do-trivia
>>>>>>                    "Updating :secret with access-token: %s" access-t=
oken)
>>>>>>                   (plist-put auth-data :secret access-token))))))
>>>>>
>>>>> The documentation for plist-put warns:
>>>>>
>>>>>   The new plist is returned;
>>>>>   use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to=
 use the new value.
>>>>>   The PLIST is modified by side effects.
>>>>>
>>>>> Alternatively, you should also be able to do:
>>>>>
>>>>>   (setf (plist-get auth-data :secret) access-token)
>>>>>
>>>>
>>>> Ah didn't know this as I learned the usage of plist-put from searching.
>>>> Changed to your `setq' version.  Though I'd also expect that the side
>>>> effect is not going away anytime soon either ;)
>>>
>>> I am not sure what you mean?  The crux of the issue is demonstrated
>>> here:
>>>
>>> (let (plist)
>>>   (list (plist-put plist :foo 1) plist))
>>> ;; ((:foo 1) nil)
>>>
>>> I.e. the plist was not modified, because there was no cons-cell to
>>> modify.
>>>
>>
>> I see.  Thanks for the explanation.  Looks like the side effect worked
>> for me because auth-data already had data in it.
>
> Probably, but that's not the kind of thing I want to rely on.
>

Ack.

>>>
>>> [...]
>>>
>>>>>>               #'auth-source-xoauth2-plugin--search-backends))
>>>>>
>>>>> I would recommend turning this into a global minor mode instead, so t=
hat
>>>>> it is easy to disable, if a user just wants to try it out.
>>>>>
>>>>
>>>> This is an interesting suggestion and sounds like a good idea.  Though
>>>> as a matter of fact the oauth2 support in auth-source in Emacs core
>>>> actually doesn't work without those hack as of now, so I don't think
>>>> it's of interest to support turning off.=20=20
>>>
>>> I regard it as a matter of good style to allow the user to disable
>>> anything then can enable, if anything then just to allow better
>>> experimentation.
>>>
>>
>> You actually convinced me.  Making it a minor mode also enables a user
>> to disable it temporarily if it causes any issues.  It took me a while
>> to convert it.  Please help take another look.
>
> Looks good.
>
>>>>                                           But of course it would be
>>>> great if auth-source can be changed to support all this out-of-the-box.
>>>> Will continue the discussion in my reply to Stefan.
>>>
>>> Ack.
>>>
>>>> I have updated the source code on GitLab[1] based on your review.
>>>> Please check it out.  Thanks very much!
>>>
>>> For anyone following the thread, it seem the footnote was missing:
>>>
>>> [1]https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/a=
uth-source-xoauth2-plugin.el
>>>
>>> Watch out, in
>>>
>>>   (unless (memq 'xoauth2 smtpmail-auth-supported)
>>>     (push 'smtpmail-auth-supported 'xoauth2))
>>>
>>> the push expression is malformed, as 'xoauth2 is not a place.  I'm
>>> guessing that you want to write
>>>
>>>   (... (push 'xoauth2 smtpmail-auth-supported))
>>>
>>
>> Thanks!  Fixed.
>>
>>> Also, checkdoc complains about
>>> `auth-source-xoauth2-plugin--search-backends's docstring.  I'd try to
>>> address the issues it mentions.
>>>
>>
>> Also fixed.  Thanks!
>>
>>> The (and auth (equal auth "xoauth2")) can be further simplified to just
>>> (equal auth "xauth2"), as if auth is equal to "xauth2" is cannot be nil.
>>>
>>
>> Ack and simplified.
>>
>> The GitLab repo[1] is updated accordingly.  PTAL.  TIA!
>
> Looks good, just a few "soft" comments I can find:
>
> diff --git a/auth-source-xoauth2-plugin.el b/auth-source-xoauth2-plugin.el
> index cdcc9e7..caf5baf 100644
> --- a/auth-source-xoauth2-plugin.el
> +++ b/auth-source-xoauth2-plugin.el
> @@ -41,7 +41,7 @@
>  ;; or with use-package:
>=20=20
>  ;;     (use-package auth-source-xoauth2-plugin
> -;;       :config
> +;;       :custom
>  ;;       (auth-source-xoauth2-plugin-mode t))
>

Quick question: I wonder whether customizing the minor mode variable is
preferred over toggling through the minor mode function?  (I assume both
will run the minor mode body.)

>  ;; After enabling, smtpmail should be supported.  To enable this in Gnus
> @@ -107,13 +107,13 @@ expected that `token_url', `client_id', `client_sec=
ret', and
>            (when (equal auth "xoauth2")
>              (auth-source-do-debug
>               ":auth set to `xoauth2'.  Will get access token.")
> -            (map-let ((:auth-url auth-url)
> -                      (:token-url token-url)
> -                      (:scope scope)
> -                      (:client-id client-id)
> -                      (:client-secret client-secret)
> -                      (:redirect-uri redirect-uri)
> -                      (:state state))
> +            (map-let (:auth-url		;You can simplify the `map-let'
> +                      :token-url	;expression if they keys match
> +                      :scope		;the bindings like they do here.
> +                      :client-id	;Perhaps you can use the additional
> +                      :client-secret	;space to document what the keys
> +                      :redirect-uri	;are for?
> +                      :state)
>                  auth-data
>                (auth-source-do-debug "Using oauth2 to auth and store toke=
n...")
>                (let ((token (oauth2-auth-and-store
> @@ -138,8 +138,7 @@ expected that `token_url', `client_id', `client_secre=
t', and
>        res)))
>=20=20
>  (defvar auth-source-xoauth2-plugin--enabled-xoauth2-by-us nil
> -  "Used for tracking whether xoauth2 in smtpmail-auth-supported is
> -set by us.")
> +  "Non-nil means `smtpmail-auth-supported' was set by us.")
>=20=20
>  (defun auth-source-xoauth2-plugin--enable ()
>    "Enable auth-source-xoauth2-plugin."
> @@ -154,17 +153,17 @@ set by us.")
>    "Disable auth-source-xoauth2-plugin."
>    (when (and auth-source-xoauth2-plugin--enabled-xoauth2-by-us
>               (memq 'xoauth2 smtpmail-auth-supported))
> -    (delete 'xoauth2 smtpmail-auth-supported)
> +    (setq smtpmail-auth-supported (delq 'xoauth2 smtpmail-auth-supported=
))
>      (setq auth-source-xoauth2-plugin--enabled-xoauth2-by-us nil))
>=20=20
>    (advice-remove #'auth-source-search-backends
>                   #'auth-source-xoauth2-plugin--search-backends))
>=20=20
> +;;;###autoload
>  (define-minor-mode auth-source-xoauth2-plugin-mode
>    "Toggle auth-source-xoauth2-plugin-mode.
>  Enable auth-source-xoauth2-plugin-mode to use xoauth2
>  authentications for emails."
> -  :lighter nil
>    :global t
>    (if auth-source-xoauth2-plugin-mode
>        (auth-source-xoauth2-plugin--enable)
>
>>
>>>>>>
>>>>>> (provide 'auth-source-xoauth2-plugin)
>>>>>>
>>>>>> ;;; auth-source-xoauth2-plugin.el ends here
>>>>>
>>>>> --=20
>>>>> 	Philip Kaludercic on siskin
>>>
>>> --=20
>>> 	Philip Kaludercic on siskin
>>
>> [1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin
>
> --=20
> 	Philip Kaludercic on siskin

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 21:46:06 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 17:46:06 2024
Received: from localhost ([127.0.0.1]:42864 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssUP8-0004Ub-9C
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 17:46:06 -0400
Received: from mail-pg1-f169.google.com ([209.85.215.169]:54557)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssUP6-0004U1-G0
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 17:46:05 -0400
Received: by mail-pg1-f169.google.com with SMTP id
 41be03b00d2f7-7163489149eso3008951a12.1
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 14:45:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727041475; x=1727646275; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=nRVJqS24q0UyBrS3WOkCMeeTu6fof5dqg61rPUgQXjk=;
 b=Gn+O9gkZjZrXnL+wHdpR7O/qDP9CTO+7Izfn01CX51TuXL44FRNfsBz6iM2i7fkJB2
 rCaR70NDaK8S02/j/DpSpFhyxltT0CI4qEqTeNOk8C6Cp3y8YqTZpy0ZtdiUBQCGiWiY
 Og0CMsSN6oyqjhTLqsUlRSxZqlAERy3G1RRu2Stlm2q8IZlLtZeTN7by0OoALOeWxJ9B
 oNEobp0Y0DfR24LwawViQbjNs5Vd2cW1db4mWO3yDxYnJ/ToYVJPokakFdU1VAHbKQnZ
 b04dF+/hTEqFayMbC7aYTOpGHFMwFraGDJRoPXOXCRgaXfbx+R1IUPCi4WUMp4GljIkM
 tmHQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727041475; x=1727646275;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=nRVJqS24q0UyBrS3WOkCMeeTu6fof5dqg61rPUgQXjk=;
 b=jtXhNvFFvtqW/+CIe769d3MFbQX4tYyEbQQBPGHooIwDefIo4JvpsBxV+S6L75SvBa
 d3L+JWDKKIyTYyyDlYIZwMxi8AY6pZXP1PRgt2zMYk3ARHMqi/kqAtRDfFM+/769jOF/
 D5GNanpsj/5ZtdVKPgb5sMstdw8HQiU9AK408SS3ZpbaPyFvSjaLpVX3lVxk9J5tUGMB
 aad/cP8sIX427gNjAA1Pek5EAFxgygwK/Ls20/4INr0pDRh6Sg2mezXRq2M2aMUA1cp7
 T2Fz4VGWub0Z8/URc7hWX5AUdgrJ8zGHoHnhf45NyPVOSjmtRGYi9GBw5+JNd+JNzewn
 Q92A==
X-Forwarded-Encrypted: i=1;
 AJvYcCXnbS7Ru8Dbf4z8o7vwpTkOSwCvFIPCOaL0CICaAAE17BpTEAf08HJHKxHESNLkFKlOpuk9aw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzzTNAczZTApX94nJG7mIrzSfL1C9g0U4HojKCZCa9+3d+PNCLn
 kj1I6Q5pOV4iU2TXCBarML7jdqGapvdpGXHTqGpbIJw+e2r1HfhE
X-Google-Smtp-Source: AGHT+IHwdzp4MBi9JXqNt0WoQVCrJhGKtM3vLB20HLM5blQeguw+R/6xZDaWhmQuIj0FQb4idhmW6g==
X-Received: by 2002:a17:90b:164b:b0:2d3:bc5f:715f with SMTP id
 98e67ed59e1d1-2dd7f405e33mr13187872a91.10.1727041475387; 
 Sun, 22 Sep 2024 14:44:35 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 98e67ed59e1d1-2dd7f7bb016sm5883617a91.3.2024.09.22.14.44.34
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 14:44:35 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>, Andrew Cohen
 <acohen@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <66f00712.170a0220.29d948.0047SMTPIN_ADDED_BROKEN@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <66f00712.170a0220.29d948.0047SMTPIN_ADDED_BROKEN@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 14:44:33 -0700
Message-ID: <87jzf34b3y.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, 72992 <at> debbugs.gnu.org,
 Philip Kaludercic <philipk@HIDDEN>, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Bj=C3=B6rn,

Bj=C3=B6rn Bidar <bjorn.bidar@HIDDEN> writes:

> Andrew Cohen <acohen@HIDDEN> writes:
>
>>>>>>> "XD" =3D=3D Xiyue Deng <manphiz@HIDDEN> writes:
>>
>>     XD> Hi Andrew, Andrew Cohen <acohen@HIDDEN> writes:
>>
>>     >>>>>>> "XD" =3D=3D Xiyue Deng <dengxiyue@HIDDEN> writes:
>>     >>=20
>>
>> [...]
>>
>>     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.
>>     >>=20
>>     >>=20
>>     >> 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.
>>
>>     XD> Thanks for pointing this out!  I found the place where `:secret'
>>     XD> is handled as a function[1].  However, this requires a user to
>>     XD> implement the oauth2 logic oneself, which I'm afraid is a bit
>>     XD> too low-level and error-prone.  (Actually, can I actually put a
>>     XD> lisp function in auth-source.gpg?)=20=20
>>
>> I don't think you have to do anything low level, and I don't think there
>> is anything error prone here; you can use the functions from oauth
>> themselves (oauth2.el can create its own plstores, but I prefer to use
>> auth-source.el to manage the stores).  The only things needed are a call
>> to oauth2-refresh-access to get a new token, and then
>> oauth2-token-access-token to return the new access token.
>
> Is this documented?  If yes where?
> I tried to look inside the auth manual nothing was mentioned.
> Would this method work with all backends?

AIUI as of now you would need to implement this logic as a function in
`:secret' of the auth-source entry.  Please do correct me though.

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 21:41:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 17:41:57 2024
Received: from localhost ([127.0.0.1]:42860 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssUL7-0004Ft-H0
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 17:41:57 -0400
Received: from mail-pl1-f182.google.com ([209.85.214.182]:45429)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssUL4-0004Ff-H4
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 17:41:55 -0400
Received: by mail-pl1-f182.google.com with SMTP id
 d9443c01a7336-2068acc8b98so34090515ad.3
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 14:41:32 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1727041226; x=1727646026; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=jgCipSW5FQZqsPFllPErQLCQv0LMhAlvX1ML5uouUaY=;
 b=guMD379/f4pnD1e3pMnTKce7wYimoerXPr4wjsNbNENoRL4pczOsdlOC8P3eDxo50T
 HV7Igr868R4QneDTxv6+jIl8zgNELc0oxPLktKKgePZdgiV/oKAOzuYR1P2wF3llK/A/
 pDVXtx7p0HAc+bEODV/yMgeg3JsgNUw+E18n1HXSBux4C3vfkyMbhOz2SLO5lswl+RAV
 ORb4+hYDUCLh7oHYpY20ERZyfoqqczIMyE1m9aRlfGB/FDXHIaiCg7vDZxJuBZcuh3La
 UcNdqkVAZo+ilphPku3GeUVn6wX2EUbJ4XgKWO5Fe0QaLJmSFe99XP8KaOis2ZZaTa68
 9NMw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1727041226; x=1727646026;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=jgCipSW5FQZqsPFllPErQLCQv0LMhAlvX1ML5uouUaY=;
 b=MA5u3IZWxCB5H3qZGwRwt6zXZO9gf1ZJSC/owTry3S0a+wuayQ4Mac3A1mGiC9/IKi
 I7n1Odhqp3Z2J04eqNFZdHkGrujnN2qopRCyBtlfyEoJA3UQ2NCviqforNT/0/IvpGcO
 WIjnrTNWIsd3JaHV4+tdPTA1vdFCmqiX2I4/1rM+WKXT3rEKzvaL+9LxpS3FytFC3wCr
 Un3wB/EcK05Ftifh+EXM/uRtG9sks6+ARzwW1aKoiIJ7sVVzymkO669U7+NxAPaK5ZWZ
 DxVUGiJDzn7yQQKhd/AHxeyC4METi7rVLxHgkhKX9+UAYGpDq0ydpW4WpLfq62Au6/e8
 YkOQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCWHcQMhFSvIdso/Ut0mFw3DwGpTFP56WELZe8t+RTSS6btt5O8Rm6GkUyeyksfPI43vmCQtCA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YzImeA9xbmpICp3Zq7r+7Rn6kpMdurBKUubcV7MissJqoBUjxZP
 rGKTT0NhMPJnL6M+A9AM7S5n7wOuQF/G7vK73ACZRjdMCaV9EmLw
X-Google-Smtp-Source: AGHT+IGJzZEZXwe9OrmKv3GrD5ijrRqXS/Zg4iCLgRgRlPIpyYYvYhvrYrvgQ64JT+tk6bS1y694qw==
X-Received: by 2002:a17:903:283:b0:207:c38:9fd7 with SMTP id
 d9443c01a7336-208d83af79amr128428475ad.22.1727041226458; 
 Sun, 22 Sep 2024 14:40:26 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-207946016a6sm123108835ad.99.2024.09.22.14.40.25
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 14:40:26 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <66f00802.050a0220.988f0.9640SMTPIN_ADDED_BROKEN@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN>
 <66f00802.050a0220.988f0.9640SMTPIN_ADDED_BROKEN@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 14:40:16 -0700
Message-ID: <87msjz4bb3.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Ted Zlatanov <tzz@HIDDEN>,
 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Bj=C3=B6rn,

Bj=C3=B6rn Bidar <bjorn.bidar@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>>> [...]
>>>
>>>     XD> P.S. Is your set up mentioned in Bug#72358 still working for
>>>     XD> outlook.com emails?  After reaching out to an MS representative
>>>     XD> they mentioned that token refresh was disabled[3] for
>>>     XD> outlook.com so I just gave up.  Maybe it still works for Outlook
>>>     XD> Org emails?
>>>
>>> Yes, it still works perfectly. I suspect that the information they gave
>>> you isn't fully accurate :)
>>
>> Thanks for confirming!  I'll follow-up in private to try to figure this
>> out if you don't mind.
>
> Could you update me on this please too?
> We have an issue with this at work.

I have reached out to Andrew offline and confirmed Andrew was using a
corp account, so there might be some corp administration settings that
enables the refreshing of access_token.  It seems to me that this is
still not possible for personal outlook.com accounts.

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 12:05:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 08:05:45 2024
Received: from localhost ([127.0.0.1]:41035 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssLLU-0006Sa-OZ
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 08:05:45 -0400
Received: from thaodan.de ([185.216.177.71]:34852)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjorn.bidar@HIDDEN>) id 1ssLLT-0006ST-Jn
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 08:05:44 -0400
Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154])
 by thaodan.de (Postfix) with ESMTPSA id 411E6D00024;
 Sun, 22 Sep 2024 15:05:21 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail;
 t=1727006721; bh=mdxqaStExNH1wEjpnRygyvoXLtRk3b0C6YfWfDbe3Sg=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=lcrpP1HqvtreaVYn/UaUMAnJxi9nyGdpscGvxK4gLJqgt22uqvjIwAxF310mIO++Q
 CqHR4ACZf51GoMkXiyY7JBYQigNrFh3nNDP3/lvqZO8VzbH8GXUbbuEwTpU96BMWIm
 2A7h2gUleIj8ILh5XSzpw3SwrADM/53r2MLxV0v1K2VFbBODVeqwm/NidgElPR0JqU
 WLefAB5E7LmCa+vUu3nvNRWeD7Jqjf1f2wFqIsK8NnMYzsDIyN8WfiJycbSGXNCVjw
 0xkpV9EdTqWrs2Vl3sLFUxPZV+MFO93SwzjvZF51fK3pPax1feCWPpPpE0rtJtOS/C
 rmGjHX1Y2+qtUsSBKDytqKysSOTSHe3uDnJ063FCA9ynwRQJ+i+yGSW6x4kVWrhuJy
 buwS8GZC6lBATtgNQuuid07w1ttsir68KminMggJ/gK4NMBt/N0j7aaVnFzZuzU726
 uuTqfwpMTpM1dxiNj/m/k6M9fq7lW3XrmGH8nKUFBDdEL7OYrNOQoZ5Tb1ncAZzM5G
 IBfjx/LPDSjHmV8JEMWJlIwKZOBH65etSIKX0eJVxDv8Jil7YBkHXBOntnR+KGdOI+
 7ylBmbk1KQidPLOHacwdn7sMvNcolTruvfHvj0e/SascNSXXNe/HHzkrG+3p8AHL+D
 rptBRMReDjJR4t0nadrlw3uA=
From: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <878qvnmfrp.fsf@HIDDEN> (Xiyue Deng's message of "Thu,
 19 Sep 2024 15:37:30 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
 <878qvnmfrp.fsf@HIDDEN>
Autocrypt: addr=bjorn.bidar@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq
 w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV
 CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl
 HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8
 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF
 CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h
 K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2
 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC
 HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN
 XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg
 gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL
 AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E
 TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB
 B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe
 pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO
 HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG
 AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr
 dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n
 KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy
 GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK
 S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA==
Date: Sun, 22 Sep 2024 15:05:20 +0300
Message-ID: <87setrsxkv.fsf@>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Xiyue Deng <manphiz@HIDDEN> writes: >> [...] >> >> XD>
 P.S. Is your set up mentioned in Bug#72358 still working for >> XD>
 outlook.com
 emails? After reaching out to an MS representative >> XD> they mentioned
 that token refresh was disab [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.2 INVALID_MSGID          Message-Id is not valid, according to RFC 2822
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 72992
Cc: Andrew Cohen <acohen@HIDDEN>, Ted Zlatanov <tzz@HIDDEN>,
 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Xiyue Deng <manphiz@HIDDEN> writes:

>> [...]
>>
>>     XD> P.S. Is your set up mentioned in Bug#72358 still working for
>>     XD> outlook.com emails?  After reaching out to an MS representative
>>     XD> they mentioned that token refresh was disabled[3] for
>>     XD> outlook.com so I just gave up.  Maybe it still works for Outlook
>>     XD> Org emails?
>>
>> Yes, it still works perfectly. I suspect that the information they gave
>> you isn't fully accurate :)
>
> Thanks for confirming!  I'll follow-up in private to try to figure this
> out if you don't mind.

Could you update me on this please too?
We have an issue with this at work.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 12:02:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 08:02:21 2024
Received: from localhost ([127.0.0.1]:41030 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssLID-0006Ek-1e
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 08:02:21 -0400
Received: from thaodan.de ([185.216.177.71]:40088)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <bjorn.bidar@HIDDEN>) id 1ssLI7-0006EX-Tm
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 08:02:19 -0400
Received: from odin (dsl-trebng12-50dc75-154.dhcp.inet.fi [80.220.117.154])
 by thaodan.de (Postfix) with ESMTPSA id 3FDFAD00024;
 Sun, 22 Sep 2024 15:01:22 +0300 (EEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=thaodan.de; s=mail;
 t=1727006482; bh=0TpmvTwORompqbWUkst/E8HwTOrmzUwJefVWai+/ZNA=;
 h=From:To:Cc:Subject:In-Reply-To:References:Date;
 b=He7Sp7XAlePjHoeUnzTrWAmqrFS9wyg6eILcSiXeJ5tqhx+0oOxPXe0B8OgsuQO5y
 YnD4H2XSur50KRwRt0fTvibLYWPQrmZcmxICc8pnntqUxVoeIHFR2kNYy0r5d/X81K
 cIuhsEyD0ya4Qwp6BQ+v0+OnCLVbsg5kjb6AqqdILWrX3m/177ZPvdnJz91RPj0WKs
 4ODc4ukkILfJaGXioGLLIoIP7sI4wYRAiGp6V7fvMHUFQ2UvFyzfilgRZBBCkd7beY
 L/8pFy8kS/aW+d3yG/cwvbTl7JR4+nah0w92DcfA/w9t119An3f2s0h4d0UXwHbB6J
 SOYx5oLHGUFo7kmAUfhbhjh/Mevzk92HGG8U2L7J3n3MHJCg7zzmuaPQ3+e7n9S8Ac
 q9xEFTQaQyY1GUtQBhXZt+G+6WEjoDxW/hn1QkwZqXvpsxXLsl+lyrLY/0IVPPD01x
 BBe/RHnVUhWJ/BS+dWq+y285BAd4Yn2zmdbxcrqH+GCFjnmNvqoR73HLFdU0nMah5c
 Nl2XMt/uVCu2Pki6dzJwdiobpALLfotruprdKdtECSYiDgcn4xfLAYcC0IWZ6VnEkj
 UjElUNNfMlcZjl/ULPXmP2vrpeE6uiofrNtI8n0uDX2bu6RuBe4wxYfX9B6Z+fu6PN
 rPR2/+AeLo2eLMeFYiEzamCI=
From: =?utf-8?Q?Bj=C3=B6rn?= Bidar <bjorn.bidar@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87zfo4au81.fsf@HIDDEN> (Andrew Cohen's message of "Thu, 19 Sep
 2024 17:06:06 +0800")
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
Autocrypt: addr=bjorn.bidar@HIDDEN; prefer-encrypt=nopreference; keydata=
 mDMEZNfpPhYJKwYBBAHaRw8BAQdACBEmr+0xwIIHZfIDlZmm7sa+lHHSb0g9FZrN6qE6ru60JUJq
 w7ZybiBCaWRhciA8Ympvcm4uYmlkYXJAdGhhb2Rhbi5kZT6IlgQTFgoAPgIbAwULCQgHAgIiAgYV
 CgkICwIEFgIDAQIeBwIXgBYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1/YmAhkBAAoJEFwbdKFl
 HF9oB9cBAJoIIGQKXm4cpap+Flxc/EGnYl0123lcEyzuduqvlDT0AQC3OlFKm/OiqJ8IMTrzJRZ8
 phFssTkSrrFXnM2jm5PYDoiTBBMWCgA7FiEEUfF263VHMB6nKairXBt0oWUcX2gFAmTX6T4CGwMF
 CwkIBwICIgIGFQoJCAsCBBYCAwECHgcCF4AACgkQXBt0oWUcX2hbCQEAtru7kvM8hi8zo6z9ux2h
 K+B5xViKuo7Z8K3IXuK5ugwA+wUfKzomzdBPhfxDsqLcEziGRxoyx0Q3ld9aermBUccHtBxCasO2
 cm4gQmlkYXIgPG1lQHRoYW9kYW4uZGU+iJMEExYKADsCGwMFCwkIBwICIgIGFQoJCAsCBBYCAwEC
 HgcCF4AWIQRR8XbrdUcwHqcpqKtcG3ShZRxfaAUCZNf2FQAKCRBcG3ShZRxfaCzSAP4hZ7cSp0YN
 XYpcjHdsySh2MuBhhoPeLGXs+2kSiqBiOwD/TP8AgPEg/R+SI9GI9on7fBJJ0mp2IT8kZ2rhDOjg
 gA6IkwQTFgoAOxYhBFHxdut1RzAepymoq1wbdKFlHF9oBQJk1+ntAhsDBQsJCAcCAiICBhUKCQgL
 AgQWAgMBAh4HAheAAAoJEFwbdKFlHF9oBgwA/iQHwe0VL4Df4GGTYlNjMSHFlIkBmN4UfYGLYj3E
 TrOUAQC51M+M3cjsL8WHdpBz6VAo6df9d+rVwhQ9vQuFHqevArg4BGTX6T4SCisGAQQBl1UBBQEB
 B0Cbohc3JEfn005/cm0AOGjSsW1ZxAkgaoVNjbpqk4MgNAMBCAeIeAQYFgoAIBYhBFHxdut1RzAe
 pymoq1wbdKFlHF9oBQJk1+k+AhsMAAoJEFwbdKFlHF9ooHABAKGmrGBic/Vys3BBrOQiRB3Z7izO
 HwhqTRpAqFZtXS2nAQDZhp/5aYw1TZjTzkm1KVt9QiYnjd/MvxRE9iaY6x4mDbgzBGTX6T4WCSsG
 AQQB2kcPAQEHQAgRJq/tMcCCB2XyA5WZpu7GvpRx0m9IPRWazeqhOq7uiO8EGBYKACAWIQRR8Xbr
 dUcwHqcpqKtcG3ShZRxfaAUCZNf71AIbIgCBCRBcG3ShZRxfaHYgBBkWCgAdFiEEUfF263VHMB6n
 KairXBt0oWUcX2gFAmTX+9QACgkQXBt0oWUcX2jeSwD6AtWn0cuo8IF35YRo4o3cDRJnUfJnbvJy
 GxyCDThR+zYBAKG6/jdwmZkBQZKslnDAbMMd2WfiZZT5JW3IWC4EaKMO7HkBAKYPGZ3UbfkRvfFK
 S+pQ9CgtNfkSJQBtT1Ob7Y6nsacgAQCpyXN7yppmhW/oBgivITPy9Lkg+V4NK9WZYZCU9Q7LBA==
Date: Sun, 22 Sep 2024 15:01:21 +0300
Message-ID: <87wmj3sxri.fsf@>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 1.2 (+)
X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 the administrator of that system for details.
 Content preview:  Andrew Cohen <acohen@HIDDEN> writes: >>>>>> "XD" == Xiyue
 Deng <manphiz@HIDDEN> writes: > > XD> Hi Andrew,
 Andrew Cohen <acohen@HIDDEN>
 writes: > > >>>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes: > >>
 > > [...] > > XD> The ba [...] 
 Content analysis details:   (1.2 points, 10.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 1.2 INVALID_MSGID          Message-Id is not valid, according to RFC 2822
 -0.0 T_SCC_BODY_TEXT_LINE   No description available.
X-Debbugs-Envelope-To: 72992
Cc: Stefan Kangas <stefankangas@HIDDEN>, Ted Zlatanov <tzz@HIDDEN>,
 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>,
 Xiyue Deng <manphiz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.2 (/)

Andrew Cohen <acohen@HIDDEN> writes:

>>>>>> "XD" == Xiyue Deng <manphiz@HIDDEN> writes:
>
>     XD> Hi Andrew, Andrew Cohen <acohen@HIDDEN> writes:
>
>     >>>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes:
>     >> 
>
> [...]
>
>     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.
>
>     XD> Thanks for pointing this out!  I found the place where `:secret'
>     XD> is handled as a function[1].  However, this requires a user to
>     XD> implement the oauth2 logic oneself, which I'm afraid is a bit
>     XD> too low-level and error-prone.  (Actually, can I actually put a
>     XD> lisp function in auth-source.gpg?)  
>
> I don't think you have to do anything low level, and I don't think there
> is anything error prone here; you can use the functions from oauth
> themselves (oauth2.el can create its own plstores, but I prefer to use
> auth-source.el to manage the stores).  The only things needed are a call
> to oauth2-refresh-access to get a new token, and then
> oauth2-token-access-token to return the new access token.

Is this documented?  If yes where?
I tried to look inside the auth manual nothing was mentioned.
Would this method work with all backends?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 09:34:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 05:34:42 2024
Received: from localhost ([127.0.0.1]:40884 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssIzJ-0006dj-Mk
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:34:42 -0400
Received: from mout02.posteo.de ([185.67.36.66]:59519)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1ssIzF-0006dO-Dm
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 05:34:40 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout02.posteo.de (Postfix) with ESMTPS id 26E15240101
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 11:34:08 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1726997649; bh=wAH9PYKp/F8EPUjpKxGwWindYErqMCWVS4d99oifBiQ=;
 h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:From;
 b=pTikAvXL7y2ZGkSpHUnEf1ge29tW8dzwGV3tEiM26fJ/m4srgjxc964Djr7FHL3b5
 A8vL7WcetlX93z9K8afZDkOFiAFXmBePTSLy+mMsUjOuhjgQ7ZpgvCht9ivYrMivjH
 7DHARAr0r2H5PsfGJeB33ulCwHswO7DIHUGWLks9OTQVIDJNn9APf87WDcnqIa39mi
 w/cCdUPEVeK9SVnVb5gkicGOo3p3aShhybqsthXyZeHMYgROswfl0HSLSR+fc/p9Wl
 dxyjZdLWLDvtyugdtLZcB/yfJRcX5vj9m7eiz/3bEBE1pQQ+OVz5l/wRvu0Yf13nff
 BRLxvnMCk1hxA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4XBLYD2sFVz9rxK;
 Sun, 22 Sep 2024 11:34:08 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87sets416y.fsf@HIDDEN> (Xiyue Deng's message of "Sun,
 22 Sep 2024 00:06:29 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN> <87o74ldpby.fsf@HIDDEN>
 <87sets416y.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
OpenPGP: id=7126E1DE2F0CE35C770BED01F2C3CC513DB89F66;
 url="https://keys.openpgp.org/vks/v1/by-fingerprint/7126E1DE2F0CE35C770BED01F2C3CC513DB89F66";
 preference=signencrypt
Date: Sun, 22 Sep 2024 09:34:08 +0000
Message-ID: <87tte89gmn.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

--=-=-=
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Xiyue Deng <manphiz@HIDDEN> writes:

> Hi Philip,
>
> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> Xiyue Deng <manphiz@HIDDEN> writes:
>>
>>> Philip Kaludercic <philipk@HIDDEN> writes:
>>>
>>>> Xiyue Deng <manphiz@HIDDEN> writes:
>>>>
>>>>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>>>>> auth-sources that enables oauth2 handling which you can find on
>>>>> Gitlab[1] (also attached).
>>>>
>>>> Once again I just want to be sure: When you say "plugin", you mean
>>>> package, right?
>>>
>>> Yes, though it's not really an independent package but a "plugin" for
>>> auth-source, a.k.a. a hack (the advice) to make auth-source to work with
>>> xoauth2.
>>
>> Just to clarify: When I say package, I mean something to add to ELPA.
>>
>
> Ah in that regard yes.
>
>>>> You are proposing to add this to GNU ELPA?
>>>
>>> Actually I would like to see which of my proposed changes to auth-source
>>> is acceptable and update auth-source in core accordingly.=20=20
>>
>> Sure it's acceptable, but in that case it would better to submit a patch
>> modifying. auth-source.el
>>
>>>                                                            I think
>>> Stefan's reply gave some suggestions in this regard and I'll follow-up
>>> in a reply there.=20=20
>>
>> I just want to second Stefan's point that some clarification as to what
>> xoauth2 is.
>>
>
> Updated the comments section with this info.

Great, that explains it well!

>>>                    Meanwhile, it may still worth adding this package
>>> to ELPA to support older Emacs versions if desired.
>>
>> In that case it might be better not to merge your changes into
>> auth-source.el directly, as that would make it more difficult to
>> automatically pull your changes out of the core to ELPA.
>>
>> An alternative is that ELPA mirrors your repository, and then we
>> manually synchronise the changes into the core, whenever there is a new
>> release.
>>
>
> I was thinking making it only for Emacs <30 if the auth-source side
> changes are upstreamed for 31.  Similar to "docker-tramp" which is only
> for EMacs <28.

The issue here is that tramp is developed outside of Emacs and
synchronised manually back into the core/automatically on ELPA, while
auth-source is currently only in the core and not distributed on ELPA.
If this remains a separate file, we could easily add it to ELPA, but I
don't know what the preference is there.

>>
>> [...]
>>
>>>>>         (let ((auth (plist-get auth-data :auth)))
>>>>>           (when (and auth
>>>>>                      (stringp auth)
>>>>>                      (string=3D auth "xoauth2"))
>>>>
>>>> You can simplify the check by just doing (equal auth "xoauth2"), as th=
is
>>>> implies all of the above (if it is `equal' to a string, it must be a
>>>> string and hence also non-nil).
>>>>
>>>
>>> Done.  Nice tip!  Coming from strong-typed languages I always want to do
>>> type-checks first in fear of any aborting error :)
>>
>> If you want strong typing, then string=3D is the right thing to use,
>> because if you want to assume that auth is always a string, then an
>> error will be signalled.  That being said, if auth has the type "Maybe
>> String", then checking the values explicitly or implicitly using equal
>> is the right approach.
>>
>
> Ack.  Thanks for the tip!
>
>>
>> [...]
>>
>>>>>               (auth-source-do-trivia "Using oauth2 to auth and store =
token...")
>>>>>               (let ((token (oauth2-auth-and-store
>>>>>                             auth-url token-url scope client-id client=
-secret
>>>>>                             redirect-uri state)))
>>>>>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-stri=
ng token))
>>>>>                 (auth-source-do-trivia "Refreshing token...")
>>>>>                 (oauth2-refresh-access token)
>>>>>                 (auth-source-do-trivia "oauth2 token after refresh: %=
s"
>>>>>                                        (pp-to-string token))
>>>>>                 (let ((access-token (oauth2-token-access-token token)=
))
>>>>>                   (auth-source-do-trivia
>>>>>                    "Updating :secret with access-token: %s" access-to=
ken)
>>>>>                   (plist-put auth-data :secret access-token))))))
>>>>
>>>> The documentation for plist-put warns:
>>>>
>>>>   The new plist is returned;
>>>>   use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to =
use the new value.
>>>>   The PLIST is modified by side effects.
>>>>
>>>> Alternatively, you should also be able to do:
>>>>
>>>>   (setf (plist-get auth-data :secret) access-token)
>>>>
>>>
>>> Ah didn't know this as I learned the usage of plist-put from searching.
>>> Changed to your `setq' version.  Though I'd also expect that the side
>>> effect is not going away anytime soon either ;)
>>
>> I am not sure what you mean?  The crux of the issue is demonstrated
>> here:
>>
>> (let (plist)
>>   (list (plist-put plist :foo 1) plist))
>> ;; ((:foo 1) nil)
>>
>> I.e. the plist was not modified, because there was no cons-cell to
>> modify.
>>
>
> I see.  Thanks for the explanation.  Looks like the side effect worked
> for me because auth-data already had data in it.

Probably, but that's not the kind of thing I want to rely on.

>>
>> [...]
>>
>>>>>               #'auth-source-xoauth2-plugin--search-backends))
>>>>
>>>> I would recommend turning this into a global minor mode instead, so th=
at
>>>> it is easy to disable, if a user just wants to try it out.
>>>>
>>>
>>> This is an interesting suggestion and sounds like a good idea.  Though
>>> as a matter of fact the oauth2 support in auth-source in Emacs core
>>> actually doesn't work without those hack as of now, so I don't think
>>> it's of interest to support turning off.=20=20
>>
>> I regard it as a matter of good style to allow the user to disable
>> anything then can enable, if anything then just to allow better
>> experimentation.
>>
>
> You actually convinced me.  Making it a minor mode also enables a user
> to disable it temporarily if it causes any issues.  It took me a while
> to convert it.  Please help take another look.

Looks good.

>>>                                           But of course it would be
>>> great if auth-source can be changed to support all this out-of-the-box.
>>> Will continue the discussion in my reply to Stefan.
>>
>> Ack.
>>
>>> I have updated the source code on GitLab[1] based on your review.
>>> Please check it out.  Thanks very much!
>>
>> For anyone following the thread, it seem the footnote was missing:
>>
>> [1]https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/au=
th-source-xoauth2-plugin.el
>>
>> Watch out, in
>>
>>   (unless (memq 'xoauth2 smtpmail-auth-supported)
>>     (push 'smtpmail-auth-supported 'xoauth2))
>>
>> the push expression is malformed, as 'xoauth2 is not a place.  I'm
>> guessing that you want to write
>>
>>   (... (push 'xoauth2 smtpmail-auth-supported))
>>
>
> Thanks!  Fixed.
>
>> Also, checkdoc complains about
>> `auth-source-xoauth2-plugin--search-backends's docstring.  I'd try to
>> address the issues it mentions.
>>
>
> Also fixed.  Thanks!
>
>> The (and auth (equal auth "xoauth2")) can be further simplified to just
>> (equal auth "xauth2"), as if auth is equal to "xauth2" is cannot be nil.
>>
>
> Ack and simplified.
>
> The GitLab repo[1] is updated accordingly.  PTAL.  TIA!

Looks good, just a few "soft" comments I can find:


--=-=-=
Content-Type: text/plain
Content-Disposition: inline

diff --git a/auth-source-xoauth2-plugin.el b/auth-source-xoauth2-plugin.el
index cdcc9e7..caf5baf 100644
--- a/auth-source-xoauth2-plugin.el
+++ b/auth-source-xoauth2-plugin.el
@@ -41,7 +41,7 @@
 ;; or with use-package:
 
 ;;     (use-package auth-source-xoauth2-plugin
-;;       :config
+;;       :custom
 ;;       (auth-source-xoauth2-plugin-mode t))
 
 ;; After enabling, smtpmail should be supported.  To enable this in Gnus
@@ -107,13 +107,13 @@ expected that `token_url', `client_id', `client_secret', and
           (when (equal auth "xoauth2")
             (auth-source-do-debug
              ":auth set to `xoauth2'.  Will get access token.")
-            (map-let ((:auth-url auth-url)
-                      (:token-url token-url)
-                      (:scope scope)
-                      (:client-id client-id)
-                      (:client-secret client-secret)
-                      (:redirect-uri redirect-uri)
-                      (:state state))
+            (map-let (:auth-url		;You can simplify the `map-let'
+                      :token-url	;expression if they keys match
+                      :scope		;the bindings like they do here.
+                      :client-id	;Perhaps you can use the additional
+                      :client-secret	;space to document what the keys
+                      :redirect-uri	;are for?
+                      :state)
                 auth-data
               (auth-source-do-debug "Using oauth2 to auth and store token...")
               (let ((token (oauth2-auth-and-store
@@ -138,8 +138,7 @@ expected that `token_url', `client_id', `client_secret', and
       res)))
 
 (defvar auth-source-xoauth2-plugin--enabled-xoauth2-by-us nil
-  "Used for tracking whether xoauth2 in smtpmail-auth-supported is
-set by us.")
+  "Non-nil means `smtpmail-auth-supported' was set by us.")
 
 (defun auth-source-xoauth2-plugin--enable ()
   "Enable auth-source-xoauth2-plugin."
@@ -154,17 +153,17 @@ set by us.")
   "Disable auth-source-xoauth2-plugin."
   (when (and auth-source-xoauth2-plugin--enabled-xoauth2-by-us
              (memq 'xoauth2 smtpmail-auth-supported))
-    (delete 'xoauth2 smtpmail-auth-supported)
+    (setq smtpmail-auth-supported (delq 'xoauth2 smtpmail-auth-supported))
     (setq auth-source-xoauth2-plugin--enabled-xoauth2-by-us nil))
 
   (advice-remove #'auth-source-search-backends
                  #'auth-source-xoauth2-plugin--search-backends))
 
+;;;###autoload
 (define-minor-mode auth-source-xoauth2-plugin-mode
   "Toggle auth-source-xoauth2-plugin-mode.
 Enable auth-source-xoauth2-plugin-mode to use xoauth2
 authentications for emails."
-  :lighter nil
   :global t
   (if auth-source-xoauth2-plugin-mode
       (auth-source-xoauth2-plugin--enable)

--=-=-=
Content-Type: text/plain


>
>>>>>
>>>>> (provide 'auth-source-xoauth2-plugin)
>>>>>
>>>>> ;;; auth-source-xoauth2-plugin.el ends here
>>>>
>>>> -- 
>>>> 	Philip Kaludercic on siskin
>>
>> -- 
>> 	Philip Kaludercic on siskin
>
> [1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin

-- 
	Philip Kaludercic on siskin

--=-=-=--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 22 Sep 2024 07:08:04 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Sep 22 03:08:04 2024
Received: from localhost ([127.0.0.1]:40762 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ssGhP-0007Cc-Kn
	for submit <at> debbugs.gnu.org; Sun, 22 Sep 2024 03:08:04 -0400
Received: from mail-pg1-f178.google.com ([209.85.215.178]:60466)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1ssGhM-0007C1-El
 for 72992 <at> debbugs.gnu.org; Sun, 22 Sep 2024 03:08:02 -0400
Received: by mail-pg1-f178.google.com with SMTP id
 41be03b00d2f7-6bce380eb96so2130449a12.0
 for <72992 <at> debbugs.gnu.org>; Sun, 22 Sep 2024 00:07:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726988793; x=1727593593; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=8hIlL69wSThP+CZKOylNjzzudS+ZeozBeApoobOENno=;
 b=dIc9AF2HzAlbOk7RmoAipEhnIoYF6y42jjHJRsjlMXMVFydBSSJUT5gVjuDZhpcIrv
 vZDPZeMF+Y/g5bpIxI+QR31BeMZqwEuy6Skb07zu9xGTMajUGkbHLAsyfEyid9+O7tPv
 SDImpedIrp9WdahDQhRcjsaRtuPzxZvurab/+XwBQFtFRbZFWQaPrp66wfCro1MIZ2yQ
 2I416uI4jhk44NNCcVNPqdcF1/Q4qRcdwMJxOA/wFNZuISoII0m5HYltddxTX4h0szEg
 4pV2hQjgclNp8Djl3Lj7rJLJRtjzx0/uWIShj1VhU6UbqJdXcGSSd6vnF9+p95drFcTl
 Hf0w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726988793; x=1727593593;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=8hIlL69wSThP+CZKOylNjzzudS+ZeozBeApoobOENno=;
 b=ItTX6+g/xtymbjI+L+QduEO+oB5n/PCKCHkNOeznsn2EkohIZ03hntwHdCFkVws8To
 Os8l0GyxzHDYdDCZ41/LviAOhp7QsbRmu2RTkKNns9ol++VB3azub0Y9QyHMg28WoOAV
 X7HkPCDp8LuF4SV5FaiwrhhOQgB8KUvD110c+/WY5rkznY6FlCe4uJ0WvoZYr8Lj+Rym
 9ndDt5q5ivoy5Yl4vTglpF37x30q3zE8N9YRRbEErOsv29FtB9HRFS+16PAATZdKIqmh
 ktJB5mSDuUhp+xjGQU1diKG+6tvoePTAR6LARWp03WOW8AtItw6PfEhq5W5bqr+X7xqV
 PVXQ==
X-Gm-Message-State: AOJu0Yy9cNhYdm4Aqo+WjMx9hq8uSqJ7LSp72ykgYO3RgTgFtQNge0DQ
 TgB31oiDE66BCsijqAWEci1DNeoOUWHnwSXLac1EFy5e3NB2q//aYiND7Q==
X-Google-Smtp-Source: AGHT+IHVnVjR0ODWMDdp9G9/HiaXLdsLAqXbjXv3XsDM/axyF9x8JpuPJhxdtvY+3Z6/lIB8UXa/qg==
X-Received: by 2002:a05:6a20:8008:b0:1d3:f20:60e9 with SMTP id
 adf61e73a8af0-1d30f2060f2mr8135965637.13.1726988792739; 
 Sun, 22 Sep 2024 00:06:32 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-7db499b8105sm13264573a12.94.2024.09.22.00.06.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 22 Sep 2024 00:06:32 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87o74ldpby.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN> <87o74ldpby.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Sun, 22 Sep 2024 00:06:29 -0700
Message-ID: <87sets416y.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Philip,

Philip Kaludercic <philipk@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>> Philip Kaludercic <philipk@HIDDEN> writes:
>>
>>> Xiyue Deng <manphiz@HIDDEN> writes:
>>>
>>>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>>>> auth-sources that enables oauth2 handling which you can find on
>>>> Gitlab[1] (also attached).
>>>
>>> Once again I just want to be sure: When you say "plugin", you mean
>>> package, right?
>>
>> Yes, though it's not really an independent package but a "plugin" for
>> auth-source, a.k.a. a hack (the advice) to make auth-source to work with
>> xoauth2.
>
> Just to clarify: When I say package, I mean something to add to ELPA.
>

Ah in that regard yes.

>>> You are proposing to add this to GNU ELPA?
>>
>> Actually I would like to see which of my proposed changes to auth-source
>> is acceptable and update auth-source in core accordingly.=20=20
>
> Sure it's acceptable, but in that case it would better to submit a patch
> modifying. auth-source.el
>
>>                                                            I think
>> Stefan's reply gave some suggestions in this regard and I'll follow-up
>> in a reply there.=20=20
>
> I just want to second Stefan's point that some clarification as to what
> xoauth2 is.
>

Updated the comments section with this info.

>>                    Meanwhile, it may still worth adding this package
>> to ELPA to support older Emacs versions if desired.
>
> In that case it might be better not to merge your changes into
> auth-source.el directly, as that would make it more difficult to
> automatically pull your changes out of the core to ELPA.
>
> An alternative is that ELPA mirrors your repository, and then we
> manually synchronise the changes into the core, whenever there is a new
> release.
>

I was thinking making it only for Emacs <30 if the auth-source side
changes are upstreamed for 31.  Similar to "docker-tramp" which is only
for EMacs <28.

>
> [...]
>
>>>>         (let ((auth (plist-get auth-data :auth)))
>>>>           (when (and auth
>>>>                      (stringp auth)
>>>>                      (string=3D auth "xoauth2"))
>>>
>>> You can simplify the check by just doing (equal auth "xoauth2"), as this
>>> implies all of the above (if it is `equal' to a string, it must be a
>>> string and hence also non-nil).
>>>
>>
>> Done.  Nice tip!  Coming from strong-typed languages I always want to do
>> type-checks first in fear of any aborting error :)
>
> If you want strong typing, then string=3D is the right thing to use,
> because if you want to assume that auth is always a string, then an
> error will be signalled.  That being said, if auth has the type "Maybe
> String", then checking the values explicitly or implicitly using equal
> is the right approach.
>

Ack.  Thanks for the tip!

>
> [...]
>
>>>>               (auth-source-do-trivia "Using oauth2 to auth and store t=
oken...")
>>>>               (let ((token (oauth2-auth-and-store
>>>>                             auth-url token-url scope client-id client-=
secret
>>>>                             redirect-uri state)))
>>>>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-strin=
g token))
>>>>                 (auth-source-do-trivia "Refreshing token...")
>>>>                 (oauth2-refresh-access token)
>>>>                 (auth-source-do-trivia "oauth2 token after refresh: %s"
>>>>                                        (pp-to-string token))
>>>>                 (let ((access-token (oauth2-token-access-token token)))
>>>>                   (auth-source-do-trivia
>>>>                    "Updating :secret with access-token: %s" access-tok=
en)
>>>>                   (plist-put auth-data :secret access-token))))))
>>>
>>> The documentation for plist-put warns:
>>>
>>>   The new plist is returned;
>>>   use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to u=
se the new value.
>>>   The PLIST is modified by side effects.
>>>
>>> Alternatively, you should also be able to do:
>>>
>>>   (setf (plist-get auth-data :secret) access-token)
>>>
>>
>> Ah didn't know this as I learned the usage of plist-put from searching.
>> Changed to your `setq' version.  Though I'd also expect that the side
>> effect is not going away anytime soon either ;)
>
> I am not sure what you mean?  The crux of the issue is demonstrated
> here:
>
> (let (plist)
>   (list (plist-put plist :foo 1) plist))
> ;; ((:foo 1) nil)
>
> I.e. the plist was not modified, because there was no cons-cell to
> modify.
>

I see.  Thanks for the explanation.  Looks like the side effect worked
for me because auth-data already had data in it.

>
> [...]
>
>>>>               #'auth-source-xoauth2-plugin--search-backends))
>>>
>>> I would recommend turning this into a global minor mode instead, so that
>>> it is easy to disable, if a user just wants to try it out.
>>>
>>
>> This is an interesting suggestion and sounds like a good idea.  Though
>> as a matter of fact the oauth2 support in auth-source in Emacs core
>> actually doesn't work without those hack as of now, so I don't think
>> it's of interest to support turning off.=20=20
>
> I regard it as a matter of good style to allow the user to disable
> anything then can enable, if anything then just to allow better
> experimentation.
>

You actually convinced me.  Making it a minor mode also enables a user
to disable it temporarily if it causes any issues.  It took me a while
to convert it.  Please help take another look.

>>                                           But of course it would be
>> great if auth-source can be changed to support all this out-of-the-box.
>> Will continue the discussion in my reply to Stefan.
>
> Ack.
>
>> I have updated the source code on GitLab[1] based on your review.
>> Please check it out.  Thanks very much!
>
> For anyone following the thread, it seem the footnote was missing:
>
> [1]https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/aut=
h-source-xoauth2-plugin.el
>
> Watch out, in
>
>   (unless (memq 'xoauth2 smtpmail-auth-supported)
>     (push 'smtpmail-auth-supported 'xoauth2))
>
> the push expression is malformed, as 'xoauth2 is not a place.  I'm
> guessing that you want to write
>
>   (... (push 'xoauth2 smtpmail-auth-supported))
>

Thanks!  Fixed.

> Also, checkdoc complains about
> `auth-source-xoauth2-plugin--search-backends's docstring.  I'd try to
> address the issues it mentions.
>

Also fixed.  Thanks!

> The (and auth (equal auth "xoauth2")) can be further simplified to just
> (equal auth "xauth2"), as if auth is equal to "xauth2" is cannot be nil.
>

Ack and simplified.

The GitLab repo[1] is updated accordingly.  PTAL.  TIA!

>>>>
>>>> (provide 'auth-source-xoauth2-plugin)
>>>>
>>>> ;;; auth-source-xoauth2-plugin.el ends here
>>>
>>> --=20
>>> 	Philip Kaludercic on siskin
>
> --=20
> 	Philip Kaludercic on siskin

[1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 22:39:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 18:39:01 2024
Received: from localhost ([127.0.0.1]:33612 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srPng-0003hn-Uk
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 18:39:01 -0400
Received: from mail-pl1-f176.google.com ([209.85.214.176]:44115)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1srPnd-0003hY-QF
 for 72992 <at> debbugs.gnu.org; Thu, 19 Sep 2024 18:38:59 -0400
Received: by mail-pl1-f176.google.com with SMTP id
 d9443c01a7336-208ccde82e6so12122955ad.0
 for <72992 <at> debbugs.gnu.org>; Thu, 19 Sep 2024 15:38:39 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726785454; x=1727390254; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=UaED+pT8lX74EqvaMpnQXeBLHkq1Qg/QX/Yfvsxdq3U=;
 b=SVkJ5kp8L2A9nmdBMEF+/OZ+cfkRwBauaElLm8GIJIQq+SBNnBSyNTjMu+3w0CA0sL
 PrGZ+wmydeeS1YP4+BYeZYNOHwi23larS6xYwv/P65NqRmctJg/J2WSIGii7UJUKZGoH
 6eQimQLtZJLRRiKfSwiNIRD6neoeqwRqB/lWZxdm/t8HmusADvE3vfYvRor2gvYrwVDR
 1wbCJLRvRlJ8/b4LX9zI4BZGn7dwHczk3Vrf8uptbu/3FI0vAALwNh/JHochMqOO3GYC
 jnDS6RvnRon0vRtytfnW13GQx0vJBGxOnnC9G0h0/iilZgsqMuIHXBqKjl65T0eQJngP
 mxtQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726785454; x=1727390254;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=UaED+pT8lX74EqvaMpnQXeBLHkq1Qg/QX/Yfvsxdq3U=;
 b=JOGntYIoLlSZzqaj1xLK4CyMm1WkcDjNvG+SHF1CVH1ynX14f1CPg8FGUF/Obl0qfa
 GpOBcMgljY+9WT28wUyklzjgx2knB3U8BNNcZDDXIX/yswYD5+dQvUv83GsWXBJz27pu
 gz5wRxtbHNafwfslClKwtT8istojItzbS1We34WPm58WzGsyoB14U23h0XHmQdzb6JJX
 +pZl4dJoAHsIiRnGwq8Nv+bRlKk0ecKN6qZ+DTrgFi90JvN8HMP5JvkfF0ZsouqqdN+B
 NwFiiaLn4lIcSvs7yxlzFgJkQubJyXkBsvuiGaBIahLPME9hM4ykD943uv1Z4OO250Lk
 NXAg==
X-Forwarded-Encrypted: i=1;
 AJvYcCX5oYcnm32br8vWZvvnhbeFTb3aJbRhZwxPDW/b8JQTR1Q+2myKIFQcf1Rqm3SBwOTekLfYKw==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyydB5zSznm54AUVs4EjgBCh0lFsUplYHFYShvlm1SiSNG9yhYM
 mEdM89O64fanEgk0FlESMUevAPm6TfXOKeClQnYCr478WBSl/GbV
X-Google-Smtp-Source: AGHT+IF2F4C21QBHy1IjxE6KNzHWR07VWAGwY3mriWJVxAlb5KkrT5BjcP1IdZvrRY2ZjpNoV7sZ+g==
X-Received: by 2002:a17:903:2b0d:b0:207:17f6:9efc with SMTP id
 d9443c01a7336-208d83b95bdmr10921045ad.25.1726785453565; 
 Thu, 19 Sep 2024 15:37:33 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-207946d2823sm84889955ad.148.2024.09.19.15.37.32
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 19 Sep 2024 15:37:33 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87zfo4au81.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN> <87zfo4au81.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Thu, 19 Sep 2024 15:37:30 -0700
Message-ID: <878qvnmfrp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Andrew Cohen <acohen@HIDDEN> writes:

>>>>>> "XD" == Xiyue Deng <manphiz@HIDDEN> writes:
>
>     XD> Hi Andrew, Andrew Cohen <acohen@HIDDEN> writes:
>
>     >>>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes:
>     >> 
>
> [...]
>
>     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.
>
>     XD> Thanks for pointing this out!  I found the place where `:secret'
>     XD> is handled as a function[1].  However, this requires a user to
>     XD> implement the oauth2 logic oneself, which I'm afraid is a bit
>     XD> too low-level and error-prone.  (Actually, can I actually put a
>     XD> lisp function in auth-source.gpg?)  
>
> I don't think you have to do anything low level, and I don't think there
> is anything error prone here; you can use the functions from oauth
> themselves (oauth2.el can create its own plstores, but I prefer to use
> auth-source.el to manage the stores).  The only things needed are a call
> to oauth2-refresh-access to get a new token, and then
> oauth2-token-access-token to return the new access token.
>

Yes, I'm not worried about power users.  I just think that the average
Emacs user would be hesitant on writing ELisp themselves to enable
xoauth2 login (hence low-level), especially when they don't have
anything to copy from (yet).  Many Gnus users are not programmers and
would prefer writing "(nnimap-authenticator 'xoauth2)" and expect it to
work.  But I believe you don't object providing that convenience OOTB
either.

> The function I wrote computes the refresh time to decide when to create
> a new token. This logic could easily be put into oauth2 instead.
>

I am planning on adding this to oauth2 as well.  Will ask for your
review when that happens.

> And yes, you can put the lisp function in auth-source.gpg (this is what
> I do).
>

TIL!  (I used to have a handwritten script to get the values for
offlineimap.  Guess we should all be using `auth-info-password')

> By the way there are some significant bugs in auth-source.el which I
> have fixed in my personal tree but haven't yet pushed. I have so little
> time for emacs at the moment, but I'll try to get around to it. And
> there is one major deficiency in auth-source.el that I want to deal
> with: obfuscation of the :secret. When Ted originally wrote
> auth-source.el he wrapped the :secret in a closure so that the secret
> itself wasn't visible in memory. At the time he did this, closures
> weren't fully part of emacs, and their implementation at the time didn't
> expose the contents of the closure in bytecode. But the current official
> implementation does, so this obfuscation trick no longer works. I want
> to remove it since it no longer works and might lead to confusion. 
>

Looking forward to it!

>     XD> Maybe auth-source source can host a helper function that checks
>     XD> if `:secret' is not set and xaouth2 is preferred (e.g. `:auth'
>     XD> is `xoauth2') and all required credentials are available it will
>     XD> get the access_token and put it `:secret' (or basically my hacky
>     XD> advice :)
>
> I think this isn't the right way to go. Currently xoauth2 is one of
> several supported SASL methods.  The logic is supposed to be to try them
> in a certain order, but this hasn't worked properly for some
> time. Nobody has noticed since almost everyone uses only the basic
> method. In gnus there has always been a server variable,
> nnimap-authenticator, that chooses the preferred sasl method, which is
> how the current support for xaouth2 is designed to work.  I think this
> is the right way to handle this (rather than relying on some specific
> form of the auth-source entry) but it would be good to fix the logic in
> nnimap.el to allow multiple methods to be tried.
>

Right.  The `:auth' trick I did is just to workaround the restriction
that `nnimap-login' chooses basic method over other methods, and I'd
prefer a better built-in support in auth-source myself.  As you
mentioned, maybe it can be remodeled after `smtpmail-try-auth-method' to
so that the login method is chosen on demand instead of trial-and-error.

> [...]
>
>     XD> P.S. Is your set up mentioned in Bug#72358 still working for
>     XD> outlook.com emails?  After reaching out to an MS representative
>     XD> they mentioned that token refresh was disabled[3] for
>     XD> outlook.com so I just gave up.  Maybe it still works for Outlook
>     XD> Org emails?
>
> Yes, it still works perfectly. I suspect that the information they gave
> you isn't fully accurate :)

Thanks for confirming!  I'll follow-up in private to try to figure this
out if you don't mind.

> -- 
> Andrew Cohen

-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 09:06:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 05:06:43 2024
Received: from localhost ([127.0.0.1]:59796 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srD7a-0001Ri-G3
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 05:06:42 -0400
Received: from mail-japanwestazon11020138.outbound.protection.outlook.com
 ([52.101.228.138]:53347 helo=OS0P286CU011.outbound.protection.outlook.com)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <acohen@HIDDEN>) id 1srD7X-0001RP-ME
 for 72992 <at> debbugs.gnu.org; Thu, 19 Sep 2024 05:06:41 -0400
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=XWYqqC4yIRVvoOHlyxGEUAzj1TojvVu7oRU6mPhnXaUv11VqXuH5nFU5c1c14B6ro4+E4kzNjHXKHJ0T3q3yDGjIlY1sNRhsUglaaNQXVVh3GlBF1eN6nnTeMAaIt5DC8GHKMksJMoqzMZYgm9k6kj8JbrNe9UnH5zC+rV2nWJla7i6W804pxOKG3qoftZz2MT7c/sJ+8omD1dy+bLAHPiTANM8Du7ztcWnRCgov2kpZxsOD2M49FS7rADcc14HyR5ZloGsDFsD/L6BeQNJz0agBKSzH4jztT1JRIvDHaA9DYCmLlSxebU6XaGrA8gSJBmWg5og7AXzMGeFdmwh80A==
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=zJWR7E/6Iyl8xqvdFiagGt6zzRyOwc4fTIZeL+9Pmts=;
 b=tjV1MAEKt6QeUzIpKVZXPTh5egLP7+9JR2FCi+LLIzJUPpQ8ZZao2mtzazHqOPgRrkFoxHSo+7yUuOfD/UiJI8jarAieqzszsybjovx7allQVfpCudUE2h2Uj2SABXfW5KMBLNBKXzr4LQ78OvOz+s2ikigLYxP4J2eK43kgHQKlk68O3DdRaGLVOOH6SDh3/P7aq3bZ7pO7oyr3suWjV6m5D7MzKhtt+XAAUyeNEQ1zpqWT5QHLcPLg0M+61H0mVV4bt3I0pZRowJzbQVfC8D03tk7H1L4OsU72m1iS/nEpCEyG5NjDmUvRYNUmF8oQTB3BJ4lkGkJdfgj1gZsM3Q==
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=zJWR7E/6Iyl8xqvdFiagGt6zzRyOwc4fTIZeL+9Pmts=;
 b=PTDoS3R/SfVUuKX4Ji54nu31SE/H+UV0De/GGtafTLS+7btfq3Tg8TSPawYA9L/jyzYbSbMRbUI8XF9UtrBgjV7F+HnFBSyMY0vZfAcVuCl2QljkDEi5wZ/oYNuc7dCtEiQj7jFFtkZv58EMRzo4Rys2tSJ9f0eHzerjVojnzvXa/RTjiKBUrcm0RWTGbb8qfI7dU+XZTw5slJXMdyXDTvpohHNE83LsO2cUHkBKC3eBCI7UKypXYtvHZns/Vb4zv5rfVS3NYzKZopPE3AYNAMHKiApLlAiGkXD6nEIQoAnAlP3XizcGk9Pp8EuPs7vW2fQfzyjdbIGXu60GH3tu4g==
Authentication-Results: dkim=none (message not signed)
 header.d=none;dmarc=none action=none header.from=ust.hk;
Received: from OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM (2603:1096:604:167::9)
 by TYRP286MB4342.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:138::5) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7962.24; Thu, 19 Sep
 2024 09:06:14 +0000
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
 09:06:14 +0000
From: Andrew Cohen <acohen@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87ldzom4rz.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
 <87ldzom4rz.fsf@HIDDEN>
Date: Thu, 19 Sep 2024 17:06:06 +0800
Message-ID: <87zfo4au81.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-ClientProxiedBy: KL1PR0401CA0027.apcprd04.prod.outlook.com
 (2603:1096:820:e::14) To OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:167::9)
MIME-Version: 1.0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: OSZP286MB1870:EE_|TYRP286MB4342:EE_
X-MS-Office365-Filtering-Correlation-Id: dcb1e9ac-4984-4e7f-688f-08dcd88a5040
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|366016;
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?KelvXi+MQQXP+rJxWi+DXEnXgPZpVBF+OUeylj8IPHsVKWwKnyJEjaehwJrw?=
 =?us-ascii?Q?Q2gPtsI7YbyfO8Ch3hdedXdbAm5VvdgvNK6ors/8/pJiImQb9qKKD4SyItZ+?=
 =?us-ascii?Q?cuSWwoCu6qQi8L2BTjnw88GUdbzbG2NdM6A/I1LAtVXAbtOTpUgWSEo/Cs/3?=
 =?us-ascii?Q?3BLWgJUzV6bQna0LNKmaK/2V6hMcsoZTnIg861bLjN92dCWmESCZXI82mTRW?=
 =?us-ascii?Q?CQFS4PaiuoZqigm1Nfn7glM69ZgHytjo6OBWQWXih6lXS4wDgrHdTfznvdc7?=
 =?us-ascii?Q?e/aSx3gJcq4lb8yftOKPJMzshTVd2SXkPzqKadQZBeSJpvQImqisDJtEemdS?=
 =?us-ascii?Q?lKXeuUMQeFU5IC2ICeta/0gxo3NhBlWpeAEGA92hovTf9o3ReBYad2WBaBmg?=
 =?us-ascii?Q?KQ/lBvj8ZBYVhmcUDMTGCboHJKxcliqeGx0iS7BdTv6fWVpDGvT5nBOglaTX?=
 =?us-ascii?Q?C08nqNZc5+LFXmizQOHkhlcE8lFA4DJCtbH0UWPwFdFSlnEImcK/aUTQj+5f?=
 =?us-ascii?Q?hwHYHuhFyujAwdDsT5vKOTjczu1+8ZY2ASHcQSSTdX1k8q9V03yoS/nhKqWM?=
 =?us-ascii?Q?rEzXhvbCbtyHIKIBGJrTmyK4gbUUz7p0ACu6W1bJHZ7SMTAT79m20FzeBE+U?=
 =?us-ascii?Q?uiyfy5DkEVTiNLwunEPyQNjb0knApIaKN1fGfzatzfLaMOd5M9aMMdEKe0IO?=
 =?us-ascii?Q?NDjtOauvn34OrHhpSuHAxW5NVJtiQs4ujq6lQKnUcX/NHFFLLisQR2sVH/MT?=
 =?us-ascii?Q?tapkAk4bprzxWG4yejv+BaKlznlBAah1LIeM2AWM7+gJRihX61Mlius4et23?=
 =?us-ascii?Q?Ki9zoLq9jegFhcdZ6Oe3yUzG4T0jg6T0l/LHtXkVgEqvHCbrmh8Hr1vc89pn?=
 =?us-ascii?Q?xp0jUfni/GzYFb/B30tkRH1t0iP81ZqXfCH9nM3pVv1PnQkSCXQ9mtBROWuV?=
 =?us-ascii?Q?SsGwW3C6KCaSWSiDAsQHokUTzity5UzqRL0cKeIpq9Ou5FzIuAj0et/cByDW?=
 =?us-ascii?Q?sQh23/Ty/cZOhRW3YEcikmemLIZ7dA0MBZnXabciWJULJVkW4gzJjewUqHra?=
 =?us-ascii?Q?Vv2Sbxw9wlFRTQo+SMIthsNjSxjMKxXddImH7JBnSyAW3rRZqdzLtSg26eVS?=
 =?us-ascii?Q?aMYwB3JFbw7c4Q3lp3DhJQONrhFhoPXMR6KqwI+IiXg+UlCOGyGAk+RSCF7x?=
 =?us-ascii?Q?MA+zBchJBPT5bhiY5aQcrlws0YFBb2e8K1guYf7E8bjXIeD0NGa+x7lHpst3?=
 =?us-ascii?Q?FLafZIX+OpR8gj4NdIFdGuFuGzDMkK422q209Vr5BiCR1tgG1EPYFypvkVXZ?=
 =?us-ascii?Q?k5pHMYKQc//pe/jug7T0h87dBJgCvn3Do6H8pLKwIo29ug=3D=3D?=
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)(376014)(366016); DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?SaB1Yo3r/F/YsLUqZMTyDL7H8tCooZ+g4ZYPq6h1VGzwlip1byy0/VMvGJDd?=
 =?us-ascii?Q?DKjNgW24B1wsaV0gX+ErsNJc/Up3kvGDjDKoesnKVvE5zHyGLbWTBf2KVzpg?=
 =?us-ascii?Q?ME/huMQsrmyIkxbLRu9aA104Kd+5qnco2HpR13h057typpEHz+s9l7j8o3YL?=
 =?us-ascii?Q?KHGpWOZ9j2jcH33anfr4a4AtMoMsMTTih8Q/PVcz6t0YS+v/Dl9LaNbMcYI/?=
 =?us-ascii?Q?5MDOrX0mPc1ZyECBJzZv1mnuoUK1kOo1E94EC5OI/kWeHMZUxexVNOztzErA?=
 =?us-ascii?Q?t7FvT18DlwDdKygvyaELKJMdMiKE5GTykzu5Vs73m+VjjMe8uruD+CIYAx7t?=
 =?us-ascii?Q?kMWU6oRkyPm7S3am86ZRNNwqcfM95rdbwTy4Hs4Aqrm+TvckqGtvZPyoHjsZ?=
 =?us-ascii?Q?9iJiqk8O43jk0XhBvCqTcOemiSJZMRlr717GCZXhgFkFdE8gCOyFxW3dt+7t?=
 =?us-ascii?Q?llOKvAdw+kmIBcNaR0c3j57uGNPKjQ5VdV5FzAnl53OoAPwz3+emQ23BZL1k?=
 =?us-ascii?Q?LJH3MO+V0Mb5brNzUH+lvgQpLk+ktQ2/lBsIDB+Hhi5/QwfN16vKjn6aNfgk?=
 =?us-ascii?Q?Y1SlH4z4lam2vE2VoJ+SaMkeSF/ybd/7RaSB4Q2lXY+e8VW7UMKX74AWQAGD?=
 =?us-ascii?Q?MG3nSigWjoTlM7yb0XK3q2uWlHsnjK4L0UWPcPC/km67Au/V4IoOaUo0LRax?=
 =?us-ascii?Q?xuStaRMDJPlLqu0mCfQCqApaXCVxyoLPlV8NLBUiFeDrzyUHlXo/oV4aumgW?=
 =?us-ascii?Q?wp/CwjMkWI95/RYWKCeLm32I2v5bhOcB3chxEG+ZKqLnva5Q2iiwCViTGl9+?=
 =?us-ascii?Q?WaF3mQgQT5dqLAdFZuvZmWrf1GH1ZhHGNxXn7ECQG4ghHXDI/QsJ66GjTd60?=
 =?us-ascii?Q?rLyzBanRdQNA4D+nhp2rmtLEeYnB7yMR/wQ5gN8nC/GSfjL8D7nFjhzsh1PY?=
 =?us-ascii?Q?iVRYieQiDyEFLCFEO+T9Pr1u+8jkhw3YM3cPpqnmc7JApu1tpNJjdfT2uJGf?=
 =?us-ascii?Q?eZkHCZ3DbPZYps21hC0QIiWRGaiHjYnyrjQmpfgAaZcQYJcrAwJUaH8774Da?=
 =?us-ascii?Q?ZBYY9mlQWQZyyz0xK20/jYShEK8GLDMJvfGJqSVC4qhRp5Y3rHqXtZZ/zc+x?=
 =?us-ascii?Q?mOjSEqoEl2hyQdOqeI/urIHtzMn3thMrO8wGFgb2VtbCwMYeWbUDKPKUgFd3?=
 =?us-ascii?Q?WrU3nz09s6RvDNSPTtRVPKDleqSFLVHjqw6DQnh/fc1s1SvDJgbMHQPa1HmU?=
 =?us-ascii?Q?qkzIUeATtZaWKa0J8m0NoENKeNop1d+ne2NmVhGnehLjdVN/4uaxDBibGCMc?=
 =?us-ascii?Q?bbH+UKRbFk0/pFlXdkmwlt0jhJwXazfW/I3Cj0gutm2jWe2HsMLqk0r8S2kO?=
 =?us-ascii?Q?MNR6jaFhgzqEt4d8Ziitfl+mdaSMqozZoIIyR5WdXA200LyV51euS9Et3KOs?=
 =?us-ascii?Q?LjAVp5wdmfWuxVjLOqvD5GqpRKkwiGHxUKBen3UKcbeeoYV/OhtBf7HC2fj6?=
 =?us-ascii?Q?exKEP90QlX0f8XIza7q5ALT7ShsWOS/FM/3N+NMVzoOyq5KtDSPT0wnHjIKZ?=
 =?us-ascii?Q?TsVmIpNhn/3FxAHhFZ8=3D?=
X-OriginatorOrg: ust.hk
X-MS-Exchange-CrossTenant-Network-Message-Id: dcb1e9ac-4984-4e7f-688f-08dcd88a5040
X-MS-Exchange-CrossTenant-AuthSource: OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM
X-MS-Exchange-CrossTenant-AuthAs: Internal
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Sep 2024 09:06:14.4533 (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: CAMthYoVJSEnVmHZpSaMW07CuuIyWjOUmxuY5nYNEp5VvBSrXybMrAQSsBCHcZNg
X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYRP286MB4342
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> "XD" == Xiyue Deng <manphiz@HIDDEN> writes:

    XD> Hi Andrew, Andrew Cohen <acohen@HIDDEN> writes:

    >>>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes:
    >> 

[...]

    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.

    XD> Thanks for pointing this out!  I found the place where `:secret'
    XD> is handled as a function[1].  However, this requires a user to
    XD> implement the oauth2 logic oneself, which I'm afraid is a bit
    XD> too low-level and error-prone.  (Actually, can I actually put a
    XD> lisp function in auth-source.gpg?)  

I don't think you have to do anything low level, and I don't think there
is anything error prone here; you can use the functions from oauth
themselves (oauth2.el can create its own plstores, but I prefer to use
auth-source.el to manage the stores).  The only things needed are a call
to oauth2-refresh-access to get a new token, and then
oauth2-token-access-token to return the new access token.

The function I wrote computes the refresh time to decide when to create
a new token. This logic could easily be put into oauth2 instead.

And yes, you can put the lisp function in auth-source.gpg (this is what
I do).

By the way there are some significant bugs in auth-source.el which I
have fixed in my personal tree but haven't yet pushed. I have so little
time for emacs at the moment, but I'll try to get around to it. And
there is one major deficiency in auth-source.el that I want to deal
with: obfuscation of the :secret. When Ted originally wrote
auth-source.el he wrapped the :secret in a closure so that the secret
itself wasn't visible in memory. At the time he did this, closures
weren't fully part of emacs, and their implementation at the time didn't
expose the contents of the closure in bytecode. But the current official
implementation does, so this obfuscation trick no longer works. I want
to remove it since it no longer works and might lead to confusion. 

    XD> Maybe auth-source source can host a helper function that checks
    XD> if `:secret' is not set and xaouth2 is preferred (e.g. `:auth'
    XD> is `xoauth2') and all required credentials are available it will
    XD> get the access_token and put it `:secret' (or basically my hacky
    XD> advice :)

I think this isn't the right way to go. Currently xoauth2 is one of
several supported SASL methods.  The logic is supposed to be to try them
in a certain order, but this hasn't worked properly for some
time. Nobody has noticed since almost everyone uses only the basic
method. In gnus there has always been a server variable,
nnimap-authenticator, that chooses the preferred sasl method, which is
how the current support for xaouth2 is designed to work.  I think this
is the right way to handle this (rather than relying on some specific
form of the auth-source entry) but it would be good to fix the logic in
nnimap.el to allow multiple methods to be tried.

[...]

    XD> P.S. Is your set up mentioned in Bug#72358 still working for
    XD> outlook.com emails?  After reaching out to an MS representative
    XD> they mentioned that token refresh was disabled[3] for
    XD> outlook.com so I just gave up.  Maybe it still works for Outlook
    XD> Org emails?

Yes, it still works perfectly. I suspect that the information they gave
you isn't fully accurate :)
-- 
Andrew Cohen




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 08:24:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 04:24:12 2024
Received: from localhost ([127.0.0.1]:59776 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1srCSR-0007Wc-Qo
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 04:24:12 -0400
Received: from mail-pl1-f174.google.com ([209.85.214.174]:50632)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1srCSN-0007WM-5L
 for 72992 <at> debbugs.gnu.org; Thu, 19 Sep 2024 04:24:10 -0400
Received: by mail-pl1-f174.google.com with SMTP id
 d9443c01a7336-2068acc8a4fso6346365ad.1
 for <72992 <at> debbugs.gnu.org>; Thu, 19 Sep 2024 01:23:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726734164; x=1727338964; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=c04r1htcIx/o9SRqtBE8LIKKuxA86Tlmz77WWzsDdTk=;
 b=APb/aF18G8OoR5/huO9nx6jS7oPb/Yt3VPznLTpVWG0rMvQZQqeeU48U7Rt8z4H362
 LaGy9hAoh54SWvmV71jTxrsLWhVK/fYf+fDIV4PzdZuB62xAv64dHSl5dzJx6ouJ+oWi
 XBQkooxYyMl9x5xeoYQ2M1nOWwdv8w5QaIIuqP57d7ExLK0jMo7QLsQfQHv2j2oRSNxT
 WDQuJ9EtZM/WbKAkFWAevQqJaqPtFpAd0HR7t3ww13ER0myUCfBfwWaUcf/rALifOncT
 DC9xfMfno1RoXWl79Js9+HmAMkXhjUK0p+AudI/XnI9u4Qc+hGPUU14XSDjkgIg60ulS
 wKsA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726734164; x=1727338964;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=c04r1htcIx/o9SRqtBE8LIKKuxA86Tlmz77WWzsDdTk=;
 b=UYUj/9fZsElO6wontzX0fbFPYD2gPp16E/wkpjGOa0CTig9rhaKwKiXa95I+KZukf/
 Vl9Oe24vWmZGZCT/rnGVyHD7zNV0oBWIbQ61aQa8Zf1KSTyZQJIwJdgyKGVQ+AykblsQ
 7VyBiiGGXU0/qy7M2yRSCh3TYFkKXaLtnCNNTlfr+0g3ykFCNHEQAthLDA1aD7GcyXD2
 RssmF4pEuwz9B1B0F2YlWX9P/ZvKrgaoWP0iJoW6gK+JkWiMl775fd258h+yujpDHHzX
 suljKuloGkilZDcLmTC4gG21stv89+MvyZOjtmaASL4FDbVyOImacSAGWOPLJmczxuYA
 yFUw==
X-Forwarded-Encrypted: i=1;
 AJvYcCW68XBUPW+d+rTJIwfD8F2GYdg3q77Ps3qU3qxl6QkWJTj0Ag5ptm6WLFQhUsWUjgYUIIP/zA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0Yxoailkf+oMQU/dyGzFYoAlAPO48FKX7DmXMgjG6nYSurCra1A3
 7TBxhbJm0oX7zEuAVe13omJWIvvy8yfl25tTnfEIzmluMC0msckq
X-Google-Smtp-Source: AGHT+IHgHWATnSv+N+j3c/mD1aQydoATNj0DkCY9UHOFldwtf3WpQbuhxVlquorudQJm882ILayF8g==
X-Received: by 2002:a17:902:e5cb:b0:205:866d:174f with SMTP id
 d9443c01a7336-20782be4e02mr244930895ad.44.1726734163628; 
 Thu, 19 Sep 2024 01:22:43 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20794735810sm75185775ad.278.2024.09.19.01.22.42
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Thu, 19 Sep 2024 01:22:43 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Andrew Cohen <acohen@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <878qvocjkz.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN> <878qvocjkz.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Thu, 19 Sep 2024 01:22:40 -0700
Message-ID: <87ldzom4rz.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Andrew,

Andrew Cohen <acohen@HIDDEN> writes:

>>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes:
>
>     XD> Hi Stefan, Stefan Kangas <stefankangas@HIDDEN> writes:
>
>     >> Xiyue Deng <manphiz@HIDDEN> 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.

Thanks for pointing this out!  I found the place where `:secret' is
handled as a function[1].  However, this requires a user to implement
the oauth2 logic oneself, which I'm afraid is a bit too low-level and
error-prone.  (Actually, can I actually put a lisp function in
auth-source.gpg?)  Maybe auth-source source can host a helper function
that checks if `:secret' is not set and xaouth2 is preferred
(e.g. `:auth' is `xoauth2') and all required credentials are available
it will get the access_token and put it `:secret' (or basically my hacky
advice :)

> 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).
>

Just remembered your comment in Bug#72358[2].  And of course if your
proposals can be part of auth-source that would be great for the users.
Still would be great to have a unified plan and make it happen.

P.S. Is your set up mentioned in Bug#72358 still working for outlook.com
emails?  After reaching out to an MS representative they mentioned that
token refresh was disabled[3] for outlook.com so I just gave up.  Maybe
it still works for Outlook Org emails?

> Best,
> Andy
>
>
> -- 
> Andrew Cohen

[1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/auth-source.el#n872
[2] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=72358#47
[3] https://stackoverflow.com/questions/78787763/getting-aadsts65001-error-invalid-grant-when-trying-to-refresh-access-token-fo

-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 05:13:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 01:13:36 2024
Received: from localhost ([127.0.0.1]:59595 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sr9Tz-0005K9-JG
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 01:13:36 -0400
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 <acohen@HIDDEN>) id 1sr9Tv-0005Jm-F3
 for 72992 <at> 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;
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
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
From: Andrew Cohen <acohen@HIDDEN>
To: Xiyue Deng <dengxiyue@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <877cb8oihg.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
 <877cb8oihg.fsf@HIDDEN>
Date: Thu, 19 Sep 2024 13:13:00 +0800
Message-ID: <878qvocjkz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
Content-Type: text/plain
X-ClientProxiedBy: KL1PR01CA0019.apcprd01.prod.exchangelabs.com
 (2603:1096:820::31) To OSZP286MB1870.JPNP286.PROD.OUTLOOK.COM
 (2603:1096:604:167::9)
MIME-Version: 1.0
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: =?us-ascii?Q?fmFRbx8PV4DVkUh4cX8XYn+oWj5RM0sm7XyDvHifKPvvOU/sqw3ItjhzLYhj?=
 =?us-ascii?Q?7FV5FTH25PI99gBSOMOoxbbmOytmrRc1MlPm1eqR5E+roHSW3b9OZ1bbTMl4?=
 =?us-ascii?Q?lTMQNQ9jZrH+c3IT1LCtqa/K5dquG3NHEUPfdqNN6lPqK2tePbsa/WtegPUa?=
 =?us-ascii?Q?qc+bKIMK0URy4vgk30Y9nYE5YoLiJhmhwzaYTt5t51io7IcM99WiJgid9o8+?=
 =?us-ascii?Q?HnC9pZeUzuRTbNswgBTJ0vR4lLfAgFnbT4hYuwfoZthC/cgy76VS/a/vZODh?=
 =?us-ascii?Q?3lbQ0G27vFEeQKE7UhSqi95e919HMX+7/uUwjwrNCzL2GODDY3sHslYo/FqV?=
 =?us-ascii?Q?Z8rLLO57sFt0KGyO8/gPigaUjNJBxpPZjSxdOn9/VB3MjXouSj6+2MAgVqQn?=
 =?us-ascii?Q?9hNbU0smSq5SJkX8fTrc75dKCEmxJfSNc3J9N5IUWwvVk3njG3TvvV+1rLV5?=
 =?us-ascii?Q?jyIvhOuJSDLyqTN/y/Y5vnzIX/9DEsCvjt8OJxYQi4r0Em53Z33YDNcnQVj/?=
 =?us-ascii?Q?iofOwWQF0tirDujNZ214uP0BkjMaQOWRyUuXFmh/vXLPLXmCxjlU47uAfVzZ?=
 =?us-ascii?Q?QIGwTAmFOqY2mk1KgbqSFArErWbNJTAmond9qysrume2u/4Orj4LmGKPUqL8?=
 =?us-ascii?Q?+PlViydicy+YVCAH+gcXMIvkTVdvfNitU0LQN/9fPUWkJ71lPyxpSGcSVMqn?=
 =?us-ascii?Q?Noa8+swIWDtPaGInMhUmNu6012eli6qAQMyxs0K4JcTIkvBbvtj/oxr48r1p?=
 =?us-ascii?Q?UfKs8S5dfxmBeiTsMCMkArelYowE71/aGCXDotzuS9zofQWiIjo5OQADdRQq?=
 =?us-ascii?Q?4BnrgDSMt14ebV7u5bxt7cSs2YYyNyLerhTx1487n2ExPwKaNk1m9j7mm928?=
 =?us-ascii?Q?AEMcwTfhOwKOVTyRUybDsqGG7BUe/ZNK0uaV45r6zIO39v2FO6K13nmL0EL5?=
 =?us-ascii?Q?2C7Ji8R7PRQSBoOBVPIGJnh5Z+6YQJZc7VQoCnPtFNYaTR1ESmZ+6fdHZ1zN?=
 =?us-ascii?Q?7yqzHgtAv6/ng9kLlgK3pIDexP5LYFvGdqSlccgDzG0xzw4I3uRBrD6hb7Lw?=
 =?us-ascii?Q?4xCjdubiFZvBSmQg0hyvuz7+4TlnaPFVq0vLz/QYOvHmSGmVcYIi/3b6Fp6c?=
 =?us-ascii?Q?KQg8uMCpKvpB9+VLqhX2J1Gt5/6g1npJpCmubdj5+Oe46Gb156Cg1Lj5bnPP?=
 =?us-ascii?Q?uPlOx69R4gKz5+TS3gb9hRiuzsyBCs9f3aBxhNaq5i9XJoZUEgFvXj5fZqvM?=
 =?us-ascii?Q?uOcQpZeiuWChrj8E+ybKG3xTPJz6TdCNuji53wbFd07+q9Ff7LZNp77gSRvF?=
 =?us-ascii?Q?1YUdXpLIpSJVoupYwklcSQ9c5VrbEH8FWq6r/U3PJYztbA=3D=3D?=
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: =?us-ascii?Q?7B+mhxyLfAhgRUp6kszdrHZVBHXAavxDGvh634kClNueOdCQg/bEMeXoCsuM?=
 =?us-ascii?Q?E9wjoJ9MBffdGkaAyUhdmmbsgbMsZqBdKcST++sIk1LWLjoFVaczgYLhhPp3?=
 =?us-ascii?Q?EsnlAPjro7mBDOVXiBMrHkOzMDtd9dKtL2i9dp5WXGlznKWI81BXW7DFCdv4?=
 =?us-ascii?Q?gNSM+wi5l7AKGkz1mP0efekm6TYGcYbuH6VU1GXhdcczzTyBVen3V+HcmPE5?=
 =?us-ascii?Q?AQtTPxwLFpAGYqVyW00ByKvwcomwOfa47z0E2GLkAvfyjiF3tVZQtmhY4jzY?=
 =?us-ascii?Q?LcE9Vk6ZpdIwqXF065cPC+mwMbLJ0TSSvwMVby0P+OU01Fwolpld9K7o//FM?=
 =?us-ascii?Q?O+thdiJy/rxz4lWUvXywL6iic3MuOXDOjjdHOd3sr4ByyYOW0i19f1G1yNxo?=
 =?us-ascii?Q?cAcmLhlTEIBP5xTZy+mP3YkFi7usGHLfShSYwuwh13A6YLQqtJfAJxg8jvcM?=
 =?us-ascii?Q?/X+2zzfnjxvLlMg+tghc8l5fsrjm9LWvTgQr8qcw4EVGzrSFghnHSHOPZeIl?=
 =?us-ascii?Q?habTwDzdgjFjHHmlwVd3XKlVJ5jJ7R4K42p+PoGzWe5JXZxR9WKeOlHp7Hfv?=
 =?us-ascii?Q?eqrlJvXB7PlYvlOcQ6/55XrGzQgPKiMr1yPg2iyPruCSaV0QhdOaFLqfaxIk?=
 =?us-ascii?Q?ouUjMKNtWjjFgWZfCDg6JpNKvy2MdXCjf7qyGbVgOfMqWDbhrPOfK55EFKgM?=
 =?us-ascii?Q?o1OOh6hMugiM01eEeTydx3mytUTV3Z/YyvXrDIz+spBJi7pnNseO5MoIdhZG?=
 =?us-ascii?Q?o1SYVCah358BJL3o8la6xBTacByOVGHvedvdjGrzJs4UYTEDU/Mo8wRv6jx1?=
 =?us-ascii?Q?YiqDC4f8Mn2ZT6FYRHXguI2UxlDDiNMvk3Mnek7Lla8jRRwM8I3rkYoL5Ix9?=
 =?us-ascii?Q?yccuFV9yaIa86mzEjGVX5BpL05pvLGm3YSi+U8R6w7QfT6dFQB5SPfBND+ml?=
 =?us-ascii?Q?VBsQczKXBrkNSr8v0jvnbJ8cPGQygUuSN8VZ10vrmJe1gNaELFi3RzrB7VW3?=
 =?us-ascii?Q?NwD9+0+UpwKZD7IzcJsVa6UwmQSAt6GxLexN945b8ua5qLQ7MyLhOj7/FWpO?=
 =?us-ascii?Q?sXvi8ui8+b8vwOEAkXVrS2Yye04nusEHcwL+5yL2b2jFqo+RCkIZ0ER/Pl19?=
 =?us-ascii?Q?PE+24/nLIxRPadrusMYze0aT2vDoOVVioCGxbxX3ioFcHPG00PlEkfKulhtd?=
 =?us-ascii?Q?CDex2Ru6tWNizBnvnGGg8S3gf6oh2UAap/j82u6sw41EtfD/gEScBLUtJ/3B?=
 =?us-ascii?Q?l2LoxPIvrqBcGbpNSpctgoK+rCY0AHLC9UjFqmM1IE3z+t0xkDYnBDdg3lNs?=
 =?us-ascii?Q?qz6K6KrW7+Dk9Dx68O0DbJa7ZqJg/Fj2tsxneIpQ6RPOy/NZfDuwn1r04lC8?=
 =?us-ascii?Q?KCpg8JcsE2UDIxWpadu/6ttnSR0xTrH+oICNzQZY+nutn/IgFFXDn6KbGvCf?=
 =?us-ascii?Q?7vNq3iZcMsW/mnki1im3Eem5JvpgWOkSA4t+RTvSIld+6xfGxJdWxIujH5Zr?=
 =?us-ascii?Q?6ReTqYGrq8F3K20Jh1yUqDmueerzNsKRuoTtyTv6IzGhNp0NziBOKzSunVo3?=
 =?us-ascii?Q?YKzbHAOqMm3k2AMwmfY=3D?=
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-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>,
 72992 <at> debbugs.gnu.org, Stefan Kangas <stefankangas@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

>>>>> "XD" == Xiyue Deng <dengxiyue@HIDDEN> writes:

    XD> Hi Stefan, Stefan Kangas <stefankangas@HIDDEN> writes:

    >> Xiyue Deng <manphiz@HIDDEN> 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




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 19 Sep 2024 04:51:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Sep 19 00:51:19 2024
Received: from localhost ([127.0.0.1]:59586 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sr98P-00042M-Uv
	for submit <at> debbugs.gnu.org; Thu, 19 Sep 2024 00:51:19 -0400
Received: from mail-pf1-f181.google.com ([209.85.210.181]:38386)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dengxiyue@HIDDEN>) id 1sr0bp-0008RP-Bx
 for 72992 <at> debbugs.gnu.org; Wed, 18 Sep 2024 15:45:08 -0400
Received: by mail-pf1-f181.google.com with SMTP id
 d2e1a72fcca58-71790698b22so7769b3a.1
 for <72992 <at> debbugs.gnu.org>; Wed, 18 Sep 2024 12:44:48 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726688623; x=1727293423; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=/rLh8Pf5l1+Hn3HAIMnFNS7UCCp1vlijgI128ljfVrs=;
 b=iSxj6WCf2s5mmERogCf7ffsJCmN35fDq0rVmMGrYnqD+LmfJ0pan9iPopKE4Mob4J3
 A5dS5aBvw9s+LKlXkhfcostrjNArHP3ZbSgFJvwXnzthQlAyTlOErg2ewZvaQGpz6Hwx
 30ONPXJnP6b2EtMY/BcZ3lj+FMhab3/XutACh/PUNgkOjOPY6c/drcXp19/cRqrCAYTm
 u6XqR44hdgjuLrAIr5a//QhCBeDxawPLKpLSN0vdI+hxlcI5Px254PykVKLw5HceBnbi
 Ba8k/0yntFYkA0vn7lO218VmWKZ5H350QyXLgulShOr80rPhIvheaOfxb+scLrM6l3VQ
 j4Gw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726688623; x=1727293423;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=/rLh8Pf5l1+Hn3HAIMnFNS7UCCp1vlijgI128ljfVrs=;
 b=RMRZZFWj2RK9YDOF6bZStkAblW0wACRcOD3kJ1BKqlTwGPeUtZLj8w02IuhvsRxYRX
 cmzj4SDSZdGvPp+tN4e4kt2RWRoqcR9NN0mEJ3PSvlHrhwa7dmPcLBGmFhrCk/q8muT3
 Khy3ArAaVuZtjQI8uWpW5JHIxr/4EyW6mL+8wCpUdnBdSG01aGr3GLkjLMEx71m7gwue
 g7ffuRMJA3Xn5AS7dyc/RjPd7AXvUvqtWHjwRPGlbAaINzvR4RAq+JxtCROi2v0LTV6e
 n5ufwVvfPLS8dmGmn3fDebFBLeWomHQkYeLmi/tEQjTl5iYrvSnngsSUFXy65LlK9U6m
 IzUw==
X-Forwarded-Encrypted: i=1;
 AJvYcCVUU8YeFyXY6wGEEmcCXQpPvSt1cAwQeTXYVleN9IMXNak/3vcE3RzvxUGWBJU4Pf1uwgcLyQ==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YyqqWKK35ss9VAgS5LznwaVZ0qG7L0UocZQTUg9gGikPLofXZS7
 e/+AkI9njOgMqIVcF4BjFs00qlzDC6Q1jAxK+9L4qCk7miNK9gd6
X-Google-Smtp-Source: AGHT+IG0uas703QUuE7keB72DldDSHb/t0uaDmYktlxNV7JiHZJnRfCgbqm9lr/hX4olVE/tZbNS4g==
X-Received: by 2002:a17:902:e54e:b0:205:5fc8:9bda with SMTP id
 d9443c01a7336-2076e3360d3mr145740765ad.1.1726688622629; 
 Wed, 18 Sep 2024 12:43:42 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-20794730becsm68819115ad.267.2024.09.18.12.43.41
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 18 Sep 2024 12:43:41 -0700 (PDT)
From: Xiyue Deng <dengxiyue@HIDDEN>
X-Google-Original-From: Xiyue Deng <manphiz@HIDDEN>
To: Stefan Kangas <stefankangas@HIDDEN>, 72992 <at> debbugs.gnu.org
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Wed, 18 Sep 2024 12:43:39 -0700
Message-ID: <877cb8oihg.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
X-Mailman-Approved-At: Thu, 19 Sep 2024 00:51:16 -0400
Cc: Ted Zlatanov <tzz@HIDDEN>, Philip Kaludercic <philipk@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Hi Stefan,

Stefan Kangas <stefankangas@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>> auth-sources that enables oauth2 handling which you can find on
>> Gitlab[1] (also attached).  As the current approach tries to override
>> some existing handling in auth-source, I would like to gather some
>> comments on how to properly integrate this handling, and see if there is
>> any benefit on providing this as a separate package for older Emacs
>> versions.
>>
>> In the comment section of the package I put notes on how xoauth2 is
>> enabled as well as existing restrictions in auth-source and how it
>> workarounds them.  I'll briefly explain below.
>
> I think it would be good if you could add to your package some general
> explanation of what xoauth2 is, and what are its use cases both in a
> general sense, and specifically together with the auth-source
> package. Don't assume that people already know what xoauth2 is, how it
> is different from oauth2, which services use it, etc. Explain it. I
> would add such general information to the beginning of the "Commentary"
> section. Nothing long is needed, just a general introduction and perhaps
> links for where to read more.
>

Good suggestions.  Added to the comments part.

> Some examples of when it would be used, preferably with example code for
> some use cases, would also go a long way.
>

I have added some examples on how to set it up and use it in Gnus and
smtpmail after sending the earlier version.  Please check it out at [1]
(with the changes above.)

>> 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?
>

The basic support is actually in the Emacs core already, e.g. for Gnus
nnimap[2] and smtpmail[3].  However, this assumes one to put the
access_token in place of `:secret' in the auth-source file as Emacs uses
password as the access_token in both places.  However, access_token
expires quite frequently (e.g. about 1 hour for Gmail) and without
refreshing it automatically it is practically impossible to use
conveniently.  Hence the propose hack and the following suggestion.

>> Because xoauth2 also makes use of
>> `secret'/`password', it makes it hard to determine whether to use
>> password-based or xoauth2-based authentication, which is why my plugin
>> asks users to set `auth' in auth-source to determine whether to use
>> xoauth2.  Another complication from this is that auth-source search
>> requires the entry contains a `secret' most of the time, where it does
>> not need to be set when using xoauth2.  Therefore I workaround this by
>> temporarily disables this check and try to retrieve access-token using
>> oauth2 and set the result as password.
>>
>> Given the inconveniences of reusing password for access-token, I wonder
>> whether we can add support for a separate `:access-token' key in the
>> auth-source entry and use that instead of password when authenticating
>> using xoauth2.  This way, we can have both password and access-token in
>> an auth-source entry and nnimap and smtpmail can use either one.  More
>> specifically:
>>
>> * When performing an auth-source search, if xoauth2 related fields are
>>   set (see the list of fields in the comments of my plugin), it will
>>   retrieve access-token using oauth2.
>>
>> * The search should change to check for either `secret'/`password' or
>>   `access-token' is available.
>>
>> * For `nnimap-login' and `smtpmail-try-auth-method', pass in both
>>   password and access-token, and for xoauth2 it should use access-token
>>   instead of password.
>>
>> If this is an acceptable approach, I'll try to draft a patch to
>> implement this in Emacs.  Otherwise, it may still worth implement the
>> current approach directly in Emacs so as to avoid using hack like
>> advice.
>
> I'm not very familiar with auth-source.el, but on a general level the
> above makes sense to me.  I've also Cc:ed Ted Zlatanov, the author of
> auth-source.el
>

Thanks!  Would also like to hear Ted's opinion on this and decide which
route to take.

>> Meanwhile, I wonder whether this may be worth release as a separate
>> package so that users of older versions can use xoauth2 as well.  I'd
>> like to make it compatible with the agreed-upon approach to minimize any
>> incompatibilities.
>>
>> Thanks for reading, and any comments are appreciated.
>
> Are you proposing to include this in Emacs core, on GNU ELPA, or
> something else?
>

I'd like to contribute to Emacs core once a direction is decided.  Maybe
also put this plugin in ELPA to support older emacs versions if both are
compatible.

> Thanks.
>

[1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin
[2] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/gnus/nnimap.el#n616
[3] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/mail/smtpmail.el#n640

--
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 18 Sep 2024 14:11:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 10:11:40 2024
Received: from localhost ([127.0.0.1]:59046 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqvP9-000748-HW
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 10:11:40 -0400
Received: from mout01.posteo.de ([185.67.36.65]:40065)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1sqvP7-00073n-I0
 for 72992 <at> debbugs.gnu.org; Wed, 18 Sep 2024 10:11:38 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 196A5240028
 for <72992 <at> debbugs.gnu.org>; Wed, 18 Sep 2024 16:11:14 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1726668675; bh=z6qB4fxwMDpHaBLV1/WXjQpEiG5H0bhTGS3cs/hvofc=;
 h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:Content-Transfer-Encoding:From;
 b=GtvvCbbEzzdi/lARSfs5+Pv6RzMjSIuKz3tNOhRF+v2F7enM8qmq2UuxfGr1uJncB
 yEMK7jZrfpbaEgovfV/0ZN1Du8bBM42NBmY/CsG51VV3FkyuSXe/vy9IYadBO3S0cT
 pm2Kg/4AJXAD+SYZjLqjT0E+6YKGFmAK+kri72B0nbxkZJ5p+lOUK+9UeZ+GpE+4sX
 bbZtaJRpLIMWgPfA6CQ82ByDycs6nCqH7Hweree6kZgWnm1Vm6+p6FUAcTXLSFL6mP
 wz1z/xm3+Y9vjSJsTb5snoD4TDsAOZJDg1GH06i5PMYa5mwLX4o5sw/2jFqaD6sQwI
 PcidS10dlwacA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4X80tp1mh1z6tyd;
 Wed, 18 Sep 2024 16:11:13 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87msk5pji2.fsf@HIDDEN> (Xiyue Deng's message of "Tue,
 17 Sep 2024 23:24:05 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
 <87msk5pji2.fsf@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
OpenPGP: id=philipk@HIDDEN;
 url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN";
 preference=signencrypt
Date: Wed, 18 Sep 2024 14:11:13 +0000
Message-ID: <87o74ldpby.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Xiyue Deng <manphiz@HIDDEN> writes:

> Philip Kaludercic <philipk@HIDDEN> writes:
>
>> Xiyue Deng <manphiz@HIDDEN> writes:
>>
>>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>>> auth-sources that enables oauth2 handling which you can find on
>>> Gitlab[1] (also attached).
>>
>> Once again I just want to be sure: When you say "plugin", you mean
>> package, right?
>
> Yes, though it's not really an independent package but a "plugin" for
> auth-source, a.k.a. a hack (the advice) to make auth-source to work with
> xoauth2.

Just to clarify: When I say package, I mean something to add to ELPA.

>> You are proposing to add this to GNU ELPA?
>
> Actually I would like to see which of my proposed changes to auth-source
> is acceptable and update auth-source in core accordingly.=20=20

Sure it's acceptable, but in that case it would better to submit a patch
modifying. auth-source.el

>                                                            I think
> Stefan's reply gave some suggestions in this regard and I'll follow-up
> in a reply there.=20=20

I just want to second Stefan's point that some clarification as to what
xoauth2 is.

>                    Meanwhile, it may still worth adding this package
> to ELPA to support older Emacs versions if desired.

In that case it might be better not to merge your changes into
auth-source.el directly, as that would make it more difficult to
automatically pull your changes out of the core to ELPA.

An alternative is that ELPA mirrors your repository, and then we
manually synchronise the changes into the core, whenever there is a new
release.


[...]

>>>         (let ((auth (plist-get auth-data :auth)))
>>>           (when (and auth
>>>                      (stringp auth)
>>>                      (string=3D auth "xoauth2"))
>>
>> You can simplify the check by just doing (equal auth "xoauth2"), as this
>> implies all of the above (if it is `equal' to a string, it must be a
>> string and hence also non-nil).
>>
>
> Done.  Nice tip!  Coming from strong-typed languages I always want to do
> type-checks first in fear of any aborting error :)

If you want strong typing, then string=3D is the right thing to use,
because if you want to assume that auth is always a string, then an
error will be signalled.  That being said, if auth has the type "Maybe
String", then checking the values explicitly or implicitly using equal
is the right approach.


[...]

>>>               (auth-source-do-trivia "Using oauth2 to auth and store to=
ken...")
>>>               (let ((token (oauth2-auth-and-store
>>>                             auth-url token-url scope client-id client-s=
ecret
>>>                             redirect-uri state)))
>>>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-string=
 token))
>>>                 (auth-source-do-trivia "Refreshing token...")
>>>                 (oauth2-refresh-access token)
>>>                 (auth-source-do-trivia "oauth2 token after refresh: %s"
>>>                                        (pp-to-string token))
>>>                 (let ((access-token (oauth2-token-access-token token)))
>>>                   (auth-source-do-trivia
>>>                    "Updating :secret with access-token: %s" access-toke=
n)
>>>                   (plist-put auth-data :secret access-token))))))
>>
>> The documentation for plist-put warns:
>>
>>   The new plist is returned;
>>   use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to us=
e the new value.
>>   The PLIST is modified by side effects.
>>
>> Alternatively, you should also be able to do:
>>
>>   (setf (plist-get auth-data :secret) access-token)
>>
>
> Ah didn't know this as I learned the usage of plist-put from searching.
> Changed to your `setq' version.  Though I'd also expect that the side
> effect is not going away anytime soon either ;)

I am not sure what you mean?  The crux of the issue is demonstrated
here:

(let (plist)
  (list (plist-put plist :foo 1) plist))
;; ((:foo 1) nil)

I.e. the plist was not modified, because there was no cons-cell to
modify.


[...]

>>>               #'auth-source-xoauth2-plugin--search-backends))
>>
>> I would recommend turning this into a global minor mode instead, so that
>> it is easy to disable, if a user just wants to try it out.
>>
>
> This is an interesting suggestion and sounds like a good idea.  Though
> as a matter of fact the oauth2 support in auth-source in Emacs core
> actually doesn't work without those hack as of now, so I don't think
> it's of interest to support turning off.=20=20

I regard it as a matter of good style to allow the user to disable
anything then can enable, if anything then just to allow better
experimentation.

>                                           But of course it would be
> great if auth-source can be changed to support all this out-of-the-box.
> Will continue the discussion in my reply to Stefan.

Ack.

> I have updated the source code on GitLab[1] based on your review.
> Please check it out.  Thanks very much!

For anyone following the thread, it seem the footnote was missing:

[1]https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/auth-=
source-xoauth2-plugin.el

Watch out, in

  (unless (memq 'xoauth2 smtpmail-auth-supported)
    (push 'smtpmail-auth-supported 'xoauth2))

the push expression is malformed, as 'xoauth2 is not a place.  I'm
guessing that you want to write

  (... (push 'xoauth2 smtpmail-auth-supported))

Also, checkdoc complains about
`auth-source-xoauth2-plugin--search-backends's docstring.  I'd try to
address the issues it mentions.

The (and auth (equal auth "xoauth2")) can be further simplified to just
(equal auth "xauth2"), as if auth is equal to "xauth2" is cannot be nil.

>>>
>>> (provide 'auth-source-xoauth2-plugin)
>>>
>>> ;;; auth-source-xoauth2-plugin.el ends here
>>
>> --=20
>> 	Philip Kaludercic on siskin

--=20
	Philip Kaludercic on siskin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 18 Sep 2024 06:25:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Sep 18 02:25:34 2024
Received: from localhost ([127.0.0.1]:56896 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqo85-0005rx-P9
	for submit <at> debbugs.gnu.org; Wed, 18 Sep 2024 02:25:34 -0400
Received: from mail-pf1-f173.google.com ([209.85.210.173]:52372)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1sqo82-0005p5-OA
 for 72992 <at> debbugs.gnu.org; Wed, 18 Sep 2024 02:25:31 -0400
Received: by mail-pf1-f173.google.com with SMTP id
 d2e1a72fcca58-71923d87be4so3660202b3a.0
 for <72992 <at> debbugs.gnu.org>; Tue, 17 Sep 2024 23:25:14 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726640649; x=1727245449; darn=debbugs.gnu.org;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=o5E2msykrTtopJI4m/ER5UjPcXtR3/mng5L/XWqyuDE=;
 b=bgJbfpGLsyvXoc+M+fs4vqJsAp+NSAcDF95HL/RsZjKyZkq6ER0KbqhSo9IOTUq06x
 zOMZ1YvogdoSLvB0L0/pP7imphD899ixCuDBY+k+6qJM/mgpYKOYtr1osG0S1hT7ud8K
 ba3bRJl0oO7B4iwakUy20aAmPObn1HvFu/oJkZk+EvqqDYOty2ve3D8AB7Vd7e3H9Y3u
 fwK8CjzQoZOBKRzpCRHvSK9f7/yk60qhOyUSHLJ7o9xxO5dZL544VP2rZLt6twYIX3iC
 3nfujEG0noNtJTd4XPWFXek96xUPMFzpDIeMxTdZX7EywqxFPhWa/23X2nWX5V0DMvSo
 fDlg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726640649; x=1727245449;
 h=content-transfer-encoding:mime-version:message-id:date:user-agent
 :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from
 :to:cc:subject:date:message-id:reply-to;
 bh=o5E2msykrTtopJI4m/ER5UjPcXtR3/mng5L/XWqyuDE=;
 b=e8dDwY9PDg5qXaaDyMp18vMAq46XYoSnkD+EUdMZbY7JzG3x8cXAFP6WCcwjdQGxvp
 bU6WkVpnks54tGThoNf6qzmfcPNUR2RmthhRhK4GuQJrqXQCbweB3r7bC7SLk5se6n3b
 mrQ/xoNYRnCvAh+VlH8z4HlizruHNUiSv3gtqjorrcVAI1w8eQJGjvMhOorqfE5gU0CQ
 Kdkk3oP0vhUiySNT8zVhb353zQYz9oRUq35VrwQI5ssI7dmTU+GXxzlR5bqHt4hq2qi3
 rO9v/tAEPXuqqX+9Vty9JxN3GzLK9Y3rS9ISwnRcNd1o17DaBQEu6yd0AmpUTsy7nEL2
 9dlg==
X-Gm-Message-State: AOJu0YwqhlDwRJIO/XcsaLxSKPay6ngRp8Bbag/Ync0nzGiPwKR1yKZm
 rDVWGEKWXAYTQUw/aB2bZoJEZRBjoYtqY592QyZj7HLj2QASWgN33Q3nioUVq9U=
X-Google-Smtp-Source: AGHT+IENHuqhxxYx1OCW+20VxDSoYhFdxaMzzKnDrJ3+zXZE9NNIZ9KbFZqBKgJRETDjxoaFYiKIFQ==
X-Received: by 2002:a05:6a20:43a0:b0:1cf:6c64:f924 with SMTP id
 adf61e73a8af0-1d112e8bff8mr28695410637.38.1726640648466; 
 Tue, 17 Sep 2024 23:24:08 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-71944ac8eadsm6048873b3a.84.2024.09.17.23.24.07
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Sep 2024 23:24:07 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87r09i14cm.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN> <87r09i14cm.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Tue, 17 Sep 2024 23:24:05 -0700
Message-ID: <87msk5pji2.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Philip Kaludercic <philipk@HIDDEN> writes:

> Xiyue Deng <manphiz@HIDDEN> writes:
>
>> Now that bug#72358 is done, as promised, I'm posting my plugin for
>> auth-sources that enables oauth2 handling which you can find on
>> Gitlab[1] (also attached).
>
> Once again I just want to be sure: When you say "plugin", you mean
> package, right?

Yes, though it's not really an independent package but a "plugin" for
auth-source, a.k.a. a hack (the advice) to make auth-source to work with
xoauth2.

> You are proposing to add this to GNU ELPA?
>

Actually I would like to see which of my proposed changes to auth-source
is acceptable and update auth-source in core accordingly.  I think
Stefan's reply gave some suggestions in this regard and I'll follow-up
in a reply there.

Meanwhile, it may still worth adding this package to ELPA to support
older Emacs versions if desired.

> [...]
>
>>
>> Thanks for reading, and any comments are appreciated.
>
> I'll be honest, I have no idea about OAuth, so my comments are just
> related to Elisp for now.  Hope that's OK!
>

Your comments are greatly helpful and much appreciated!  Please see my
replies below.

>> [1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin
>
>> ;; Copyright (C) 2024 Xiyue Deng <manphiz@HIDDEN>
>>
>> ;; Author: Xiyue Deng <manphiz@HIDDEN>
>> ;; Version: 0.1-git
>> ;; Package-Requires: ((emacs "28.1") (oauth2 "0.17"))
>>
>> ;; This file is not part of GNU Emacs.
>>
>> ;; GNU Emacs is free software: you can redistribute it and/or modify
>> ;; it under the terms of the GNU General Public License as published by
>> ;; the Free Software Foundation, either version 3 of the License, or
>> ;; (at your option) any later version.
>>
>> ;; GNU Emacs is distributed in the hope that it will be useful,
>> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
>> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
>> ;; GNU General Public License for more details.
>>
>> ;; You should have received a copy of the GNU General Public License
>> ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
>>
>> ;;; Commentary:
>>
>> ;; This package enables support for xoauth2 authentication with
>> ;; auth-source.  To set up, please put this file in the `load-path' of
>> ;; Emacs, and add the following lines in your Emacs configuration:
>>
>> ;;     (require 'auth-source-xoauth2-plugin)
>> ;;     (auth-source-xoauth2-plugin-enable)
>>
>> ;; or with use-package:
>>
>> ;;     (use-package auth-source-xoauth2-plugin
>> ;;       :config
>> ;;       (auth-source-xoauth2-plugin-enable))
>>
>> ;; After enabling, smtpmail should be supported.  To enable this in Gnus
>> ;; nnimap, you should also set `(nnimap-authenticator xoauth2)' in the
>> ;; corresponding account settings in `gnus-secondary-select-methods'
>>
>> ;; auth-source uses the `secret' field in auth-source file as password
>> ;; for authentication, including xoauth2.  To decide which
>> ;; authentication method to use (e.g. plain password vs xoauth2), it
>> ;; inspects the `auth' field from the auth-source entry, and if the
>> ;; value is `xaouth2', it will try to gather data and get the access
>> ;; token for use of xoauth2 authentication; otherwise, it will fallback
>> ;; to the default authentication method.
>>
>> ;; When xoauth2 authentication is enabled, it will try to get the
>> ;; following data from the auth-source entry: `auth-url', `token-url',
>> ;; `scope', `client-id', `client-secret', `redirect-uri', and optionally
>> ;; `state'.  These information will be used by oauth2 to retrieve the
>> ;; access-token.  This package uses an advice to switch the auth-source
>> ;; search result from the `password' to the `access-token' it got, which
>> ;; in turn will be used to construct the xoauth2 authentication string,
>> ;; currently in nnimap-login and smtpmail-try-auth-method.  To really
>> ;; enable xoauth2 in smtpmail, it will add 'xoauth2 to
>> ;; 'smtpmail-auth-supported (if it is not already in the list) using
>> ;; `add-to-list' so that xoauth2 is tried first.
>>
>> ;; Note that currently the auth-source requires the searched entry must
>> ;; have `secret' field set in the entry, which is not necessary when
>> ;; using xoauth2.  Therefore in the advice it temporarily disables
>> ;; checking for `:secret' if set and perform the search, and check the
>> ;; result before returning.
>>
>> ;;; Code:
>>
>> (require 'auth-source)
>> (require 'cl-lib)
>> (require 'oauth2)
>> (require 'smtpmail)
>>
>> (defun auth-source-xoauth2-plugin--search-backends (orig-fun &rest args)
>>   "Perform auth-source-search and set password as access-token when requ=
ested.
>> The substitution only happens if one sets `auth' to `xoauth2' in
>> your auth-source-entry.  It is expected that `token_url',
>> `client_id', `client_secret', and `refresh_token' are properly
>> set along `host', `user', and `port' (note the snake_case)."
>>   (auth-source-do-trivia "Advising auth-source-search")
>>   (let (check-secret)
>>     (when (memq :secret (nth 5 args))
>>       (auth-source-do-trivia
>>        "Required fields include :secret.  As we are requesting access to=
ken to replace the secret, we'll temporary remove :secret from the require =
list and check that it's properly set to a valid access token later.")
>>       (setf (nth 5 args) (remove :secret (nth 5 args)))
>>       (setq check-secret t))
>>     (let ((orig-res (apply orig-fun args))
>>           res)
>>       (dolist (auth-data orig-res)
>>         (auth-source-do-trivia "Matched auth data: %s" (pp-to-string aut=
h-data))
>
> Is "trivia" the right debug level for all the messages in this function?
> I feel like some of them should at least be "debug".
>

Indeed.  I have changed logs without token to be "debug"-level.

>>         (let ((auth (plist-get auth-data :auth)))
>>           (when (and auth
>>                      (stringp auth)
>>                      (string=3D auth "xoauth2"))
>
> You can simplify the check by just doing (equal auth "xoauth2"), as this
> implies all of the above (if it is `equal' to a string, it must be a
> string and hence also non-nil).
>

Done.  Nice tip!  Coming from strong-typed languages I always want to do
type-checks first in fear of any aborting error :)

>>             (auth-source-do-debug
>>              ":auth set to `xoauth2'.  Will get access token.")
>>             (let ((auth-url (plist-get auth-data :auth-url))
>>                   (token-url (plist-get auth-data :token-url))
>>                   (scope (plist-get auth-data :scope))
>>                   (client-id (plist-get auth-data :client-id))
>>                   (client-secret (plist-get auth-data :client-secret))
>>                   (redirect-uri (plist-get auth-data :redirect-uri))
>>                   (state (plist-get auth-data :state)))
>
> I feel like this could be simplified with a map-let expression.=20=20
>
>   (map-let (:auth-url :token-url ...) auth-data
>     ...)
>=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
> You should be able to require 'map at compile time, so that the
> expansions don't occur an overhead during run-time.
>

Another nice TIL!

>>               (auth-source-do-trivia "Using oauth2 to auth and store tok=
en...")
>>               (let ((token (oauth2-auth-and-store
>>                             auth-url token-url scope client-id client-se=
cret
>>                             redirect-uri state)))
>>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-string =
token))
>>                 (auth-source-do-trivia "Refreshing token...")
>>                 (oauth2-refresh-access token)
>>                 (auth-source-do-trivia "oauth2 token after refresh: %s"
>>                                        (pp-to-string token))
>>                 (let ((access-token (oauth2-token-access-token token)))
>>                   (auth-source-do-trivia
>>                    "Updating :secret with access-token: %s" access-token)
>>                   (plist-put auth-data :secret access-token))))))
>
> The documentation for plist-put warns:
>
>   The new plist is returned;
>   use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to use=
 the new value.
>   The PLIST is modified by side effects.
>
> Alternatively, you should also be able to do:
>
>   (setf (plist-get auth-data :secret) access-token)
>

Ah didn't know this as I learned the usage of plist-put from searching.
Changed to your `setq' version.  Though I'd also expect that the side
effect is not going away anytime soon either ;)

>>
>>         (unless (and check-secret
>>                      (not (plist-get auth-data :secret)))
>>           (auth-source-do-trivia "Updating auth-source-search results.")
>>           (add-to-list 'res auth-data t)))
>
> This should definitely be a `push', as `res' is lexically scoped (see
> docstring for `add-to-list').
>

Indeed.  Guess I got lucky here that it behaves the same.

>>       res)))
>>
>> ;;;###autoload
>> (defun auth-source-xoauth2-plugin-enable ()
>>   "Enable auth-source-xoauth2-plugin."
>>   (unless (memq 'xoauth2 smtpmail-auth-supported)
>>     (add-to-list 'smtpmail-auth-supported 'xoauth2))
>
> In functions, it would be more conventional to use push.  Especially
> because `add-to-list' checks for duplicates, which you have already
> done.
>

Ack.

>>
>>   (advice-add 'auth-source-search-backends :around
>
> There's no reason not to sharp-quote the function here as well?
>

Indeed.  Added.

>>               #'auth-source-xoauth2-plugin--search-backends))
>
> I would recommend turning this into a global minor mode instead, so that
> it is easy to disable, if a user just wants to try it out.
>

This is an interesting suggestion and sounds like a good idea.  Though
as a matter of fact the oauth2 support in auth-source in Emacs core
actually doesn't work without those hack as of now, so I don't think
it's of interest to support turning off.  But of course it would be
great if auth-source can be changed to support all this out-of-the-box.
Will continue the discussion in my reply to Stefan.

I have updated the source code on GitLab[1] based on your review.
Please check it out.  Thanks very much!

>>
>> (provide 'auth-source-xoauth2-plugin)
>>
>> ;;; auth-source-xoauth2-plugin.el ends here
>
> --=20
> 	Philip Kaludercic on siskin

--=20
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 17 Sep 2024 21:34:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 17 17:34:29 2024
Received: from localhost ([127.0.0.1]:56140 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqfq9-0006y1-Fp
	for submit <at> debbugs.gnu.org; Tue, 17 Sep 2024 17:34:29 -0400
Received: from mail-ed1-f53.google.com ([209.85.208.53]:42436)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <stefankangas@HIDDEN>) id 1sqfq6-0006xk-8k
 for 72992 <at> debbugs.gnu.org; Tue, 17 Sep 2024 17:34:27 -0400
Received: by mail-ed1-f53.google.com with SMTP id
 4fb4d7f45d1cf-5c40942358eso271876a12.1
 for <72992 <at> debbugs.gnu.org>; Tue, 17 Sep 2024 14:34:10 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726608785; x=1727213585; darn=debbugs.gnu.org;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:from:to:cc:subject:date:message-id:reply-to;
 bh=F0x1iyONWZdaHA2N9Wl8matPXl7mz1fl96oV7zh+jVs=;
 b=HHoA4Y+W5tQSGMkTc7Pda1Q4ZGutXO8+fdt2DzxfWydE44/csOPxjwE/iKZV1GDfo7
 Do8Wg1dPtW+UXgCsuCD0VgO1cobMPATXFxQE9tSZbq9Qq9qlb3ljU1a3ToNsNZczTGiT
 rNm9HOsl8+uM/UTVMrvLywuxiwQ36kDONU2CNY49PXLoRAySLvhvTX1bLkPhYnY4RseU
 YHQ35LQUjXcXv45gw8e5+aEEITsI5RBJkYqJcFSaIj47ktuvuwYJq1NVuzCBAKaAiGfJ
 ttfVWKRnCWC86UG+Xx1dq6IYZJNAJgU0FDDV5W0IzxAhXG4dHGASHo2MvRYICtVIVqba
 FWgA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726608785; x=1727213585;
 h=cc:to:subject:message-id:date:mime-version:references:in-reply-to
 :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=F0x1iyONWZdaHA2N9Wl8matPXl7mz1fl96oV7zh+jVs=;
 b=H58NiU10/lZjF+WW2evzaGlVfqw6qfqZHikQdgGk2pG3xNrxRy+7qEgioZR4Wpion1
 MhCoqr1vFaVXWZbW5qfExi2GZDuUGepm8xCG0NvGGaus3id51VJlnjAq9rhQdL5107JY
 y9AHfeeBzvf4JY409Pl6OevO9Y4CgtpzWMwj8KygcbAGTwBWyrC1XJf8NtWTX6D/WYPN
 8Kg8MkmQa6BIPvtLVGzKRdxTp5E9Zn4YnPRJzMTDxTD6lkqY35kByurwNeFzvlwOzeR1
 fuVoxeUDmO6rGWBmctbYxLDU/YdHSO9GpGwQ8uBuyxhMTdYM1HtgPyU/AX7BtIVVfiVA
 cFRQ==
X-Forwarded-Encrypted: i=1;
 AJvYcCVQ0FZhjTb/BZZeTgfNwMgY9J5NcBPVdd82iDLHHLKt2XJq+GrvDVXRXkIbvRDTx67em1RpzA==@debbugs.gnu.org
X-Gm-Message-State: AOJu0YwcoQOQtngXNkIKzav65YAHABuQSDoLro4SDDMAi74tVlQ5KpNT
 mpDpxR1OOU0g6yVPv2jMEP24o9wA0/FWUj1WObyvxNF7aJ5ULbQJTzXSkA4A5dxYvAbNplmTKui
 JPR7vPSukdBPJNeZAZc+I873jAa4=
X-Google-Smtp-Source: AGHT+IERF6YLeZUY3TIx1LSdegSUleQLmNBHXHQ0nGsIJW7Cn6PGhpM0XiCLu3YGqmyHGus79IAfGcQvmpRmiNZud9M=
X-Received: by 2002:a50:8d85:0:b0:5c2:5f31:8888 with SMTP id
 4fb4d7f45d1cf-5c401602585mr22308168a12.15.1726608784772; Tue, 17 Sep 2024
 14:33:04 -0700 (PDT)
Received: from 753933720722 named unknown by gmailapi.google.com with
 HTTPREST; Tue, 17 Sep 2024 21:33:04 +0000
From: Stefan Kangas <stefankangas@HIDDEN>
In-Reply-To: <87h6ayfo87.fsf_-_@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
MIME-Version: 1.0
Date: Tue, 17 Sep 2024 21:33:04 +0000
Message-ID: <CADwFkmmMeFux=1bqYHg5r8ibp7-ZaV724dfMXneht9eYHMLkZg@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
To: Xiyue Deng <manphiz@HIDDEN>, 72992 <at> debbugs.gnu.org
Content-Type: text/plain; charset="UTF-8"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
Cc: Ted Zlatanov <tzz@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Xiyue Deng <manphiz@HIDDEN> writes:

> Now that bug#72358 is done, as promised, I'm posting my plugin for
> auth-sources that enables oauth2 handling which you can find on
> Gitlab[1] (also attached).  As the current approach tries to override
> some existing handling in auth-source, I would like to gather some
> comments on how to properly integrate this handling, and see if there is
> any benefit on providing this as a separate package for older Emacs
> versions.
>
> In the comment section of the package I put notes on how xoauth2 is
> enabled as well as existing restrictions in auth-source and how it
> workarounds them.  I'll briefly explain below.

I think it would be good if you could add to your package some general
explanation of what xoauth2 is, and what are its use cases both in a
general sense, and specifically together with the auth-source
package. Don't assume that people already know what xoauth2 is, how it
is different from oauth2, which services use it, etc. Explain it. I
would add such general information to the beginning of the "Commentary"
section. Nothing long is needed, just a general introduction and perhaps
links for where to read more.

Some examples of when it would be used, preferably with example code for
some use cases, would also go a long way.

> 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?

> Because xoauth2 also makes use of
> `secret'/`password', it makes it hard to determine whether to use
> password-based or xoauth2-based authentication, which is why my plugin
> asks users to set `auth' in auth-source to determine whether to use
> xoauth2.  Another complication from this is that auth-source search
> requires the entry contains a `secret' most of the time, where it does
> not need to be set when using xoauth2.  Therefore I workaround this by
> temporarily disables this check and try to retrieve access-token using
> oauth2 and set the result as password.
>
> Given the inconveniences of reusing password for access-token, I wonder
> whether we can add support for a separate `:access-token' key in the
> auth-source entry and use that instead of password when authenticating
> using xoauth2.  This way, we can have both password and access-token in
> an auth-source entry and nnimap and smtpmail can use either one.  More
> specifically:
>
> * When performing an auth-source search, if xoauth2 related fields are
>   set (see the list of fields in the comments of my plugin), it will
>   retrieve access-token using oauth2.
>
> * The search should change to check for either `secret'/`password' or
>   `access-token' is available.
>
> * For `nnimap-login' and `smtpmail-try-auth-method', pass in both
>   password and access-token, and for xoauth2 it should use access-token
>   instead of password.
>
> If this is an acceptable approach, I'll try to draft a patch to
> implement this in Emacs.  Otherwise, it may still worth implement the
> current approach directly in Emacs so as to avoid using hack like
> advice.

I'm not very familiar with auth-source.el, but on a general level the
above makes sense to me.  I've also Cc:ed Ted Zlatanov, the author of
auth-source.el

> Meanwhile, I wonder whether this may be worth release as a separate
> package so that users of older versions can use xoauth2 as well.  I'd
> like to make it compatible with the agreed-upon approach to minimize any
> incompatibilities.
>
> Thanks for reading, and any comments are appreciated.

Are you proposing to include this in Emacs core, on GNU ELPA, or
something else?

Thanks.

> [1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 17 Sep 2024 19:13:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 17 15:13:22 2024
Received: from localhost ([127.0.0.1]:55992 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqdda-0007Pi-4S
	for submit <at> debbugs.gnu.org; Tue, 17 Sep 2024 15:13:22 -0400
Received: from mout01.posteo.de ([185.67.36.65]:38845)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <philipk@HIDDEN>) id 1sqddX-0007PO-Ix
 for 72992 <at> debbugs.gnu.org; Tue, 17 Sep 2024 15:13:20 -0400
Received: from submission (posteo.de [185.67.36.169]) 
 by mout01.posteo.de (Postfix) with ESMTPS id 0198D240027
 for <72992 <at> debbugs.gnu.org>; Tue, 17 Sep 2024 21:12:58 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017;
 t=1726600379; bh=qqj8rvL3l52lNBlB5JnB0r03+++ehKbkBnaVNV2s9lM=;
 h=From:To:Cc:Subject:Autocrypt:OpenPGP:Date:Message-ID:MIME-Version:
 Content-Type:Content-Transfer-Encoding:From;
 b=Vp/rgWmPwnuhI7SQ917lFf1+Kvsr6BZLwOcV64LWbMPkvrggDQ+j3D6Q+zf2eCk00
 5+JIx3Eclu7hqtD7DYRXcXoFXkgiaQVAtA3RglGNqZgQqbC5jiBh2FtQqkVQqFfXra
 njZTKj+LVDJ8jL4niGpkJV44Sm3K0UNpOI/Kh5sFxYPjMvHQPc4t4uLlox2uO4CvMu
 FrwH9EHHywtqoSFFokOm/rNxzNIsYDE9iFa6lbPqtbIBuaNgTqmr9UHN79NX5G7nY8
 O7ENqbEzPT0UZJLL5K1Btg5BOL3ZgUFw1MWOMuao48cc88xrIpYn6Vp5ytPQ/Whpy4
 eu6aXSoPDxJNA==
Received: from customer (localhost [127.0.0.1])
 by submission (posteo.de) with ESMTPSA id 4X7WdQ3Mpbz9rxD;
 Tue, 17 Sep 2024 21:12:58 +0200 (CEST)
From: Philip Kaludercic <philipk@HIDDEN>
To: Xiyue Deng <manphiz@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <87h6ayfo87.fsf_-_@HIDDEN> (Xiyue Deng's message of
 "Mon, 02 Sep 2024 01:34:32 -0700")
References: <87h6ayfo87.fsf_-_@HIDDEN>
Autocrypt: addr=philipk@HIDDEN; keydata=
 mDMEZBBQQhYJKwYBBAHaRw8BAQdAHJuofBrfqFh12uQu0Yi7mrl525F28eTmwUDflFNmdui0QlBo
 aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0
 ZW8ubmV0PoiWBBMWCAA+FiEEDg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwMFCQHhM4AFCwkI
 BwIGFQoJCAsCBBYCAwECHgECF4AACgkQ8xYDWXahwulikAEA77hloUiSrXgFkUVJhlKBpLCHUjA0
 mWZ9j9w5d08+jVwBAK6c4iGP7j+/PhbkxaEKa4V3MzIl7zJkcNNjHCXmvFcEuDgEZBBQQhIKKwYB
 BAGXVQEFAQEHQI5NLiLRjZy3OfSt1dhCmFyn+fN/QKELUYQetiaoe+MMAwEIB4h+BBgWCAAmFiEE
 Dg7HY17ghYlni8XN8xYDWXahwukFAmQQUEICGwwFCQHhM4AACgkQ8xYDWXahwukm+wEA8cml4JpK
 NeAu65rg+auKrPOP6TP/4YWRCTIvuYDm0joBALw98AMz7/qMHvSCeU/hw9PL6u6R2EScxtpKnWof
 z4oM
OpenPGP: id=philipk@HIDDEN;
 url="https://keys.openpgp.org/vks/v1/by-email/philipk@HIDDEN";
 preference=signencrypt
Date: Tue, 17 Sep 2024 19:12:57 +0000
Message-ID: <87r09i14cm.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 72992
Cc: 72992 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)


Xiyue Deng <manphiz@HIDDEN> writes:

> Now that bug#72358 is done, as promised, I'm posting my plugin for
> auth-sources that enables oauth2 handling which you can find on
> Gitlab[1] (also attached).

Once again I just want to be sure: When you say "plugin", you mean
package, right?  You are proposing to add this to GNU ELPA?

[...]

>
> Thanks for reading, and any comments are appreciated.

I'll be honest, I have no idea about OAuth, so my comments are just
related to Elisp for now.  Hope that's OK!

> [1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin

> ;; Copyright (C) 2024 Xiyue Deng <manphiz@HIDDEN>
>
> ;; Author: Xiyue Deng <manphiz@HIDDEN>
> ;; Version: 0.1-git
> ;; Package-Requires: ((emacs "28.1") (oauth2 "0.17"))
>
> ;; This file is not part of GNU Emacs.
>
> ;; GNU Emacs is free software: you can redistribute it and/or modify
> ;; it under the terms of the GNU General Public License as published by
> ;; the Free Software Foundation, either version 3 of the License, or
> ;; (at your option) any later version.
>
> ;; GNU Emacs is distributed in the hope that it will be useful,
> ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
> ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> ;; GNU General Public License for more details.
>
> ;; You should have received a copy of the GNU General Public License
> ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
>
> ;;; Commentary:
>
> ;; This package enables support for xoauth2 authentication with
> ;; auth-source.  To set up, please put this file in the `load-path' of
> ;; Emacs, and add the following lines in your Emacs configuration:
>
> ;;     (require 'auth-source-xoauth2-plugin)
> ;;     (auth-source-xoauth2-plugin-enable)
>
> ;; or with use-package:
>
> ;;     (use-package auth-source-xoauth2-plugin
> ;;       :config
> ;;       (auth-source-xoauth2-plugin-enable))
>
> ;; After enabling, smtpmail should be supported.  To enable this in Gnus
> ;; nnimap, you should also set `(nnimap-authenticator xoauth2)' in the
> ;; corresponding account settings in `gnus-secondary-select-methods'
>
> ;; auth-source uses the `secret' field in auth-source file as password
> ;; for authentication, including xoauth2.  To decide which
> ;; authentication method to use (e.g. plain password vs xoauth2), it
> ;; inspects the `auth' field from the auth-source entry, and if the
> ;; value is `xaouth2', it will try to gather data and get the access
> ;; token for use of xoauth2 authentication; otherwise, it will fallback
> ;; to the default authentication method.
>
> ;; When xoauth2 authentication is enabled, it will try to get the
> ;; following data from the auth-source entry: `auth-url', `token-url',
> ;; `scope', `client-id', `client-secret', `redirect-uri', and optionally
> ;; `state'.  These information will be used by oauth2 to retrieve the
> ;; access-token.  This package uses an advice to switch the auth-source
> ;; search result from the `password' to the `access-token' it got, which
> ;; in turn will be used to construct the xoauth2 authentication string,
> ;; currently in nnimap-login and smtpmail-try-auth-method.  To really
> ;; enable xoauth2 in smtpmail, it will add 'xoauth2 to
> ;; 'smtpmail-auth-supported (if it is not already in the list) using
> ;; `add-to-list' so that xoauth2 is tried first.
>
> ;; Note that currently the auth-source requires the searched entry must
> ;; have `secret' field set in the entry, which is not necessary when
> ;; using xoauth2.  Therefore in the advice it temporarily disables
> ;; checking for `:secret' if set and perform the search, and check the
> ;; result before returning.
>
> ;;; Code:
>
> (require 'auth-source)
> (require 'cl-lib)
> (require 'oauth2)
> (require 'smtpmail)
>
> (defun auth-source-xoauth2-plugin--search-backends (orig-fun &rest args)
>   "Perform auth-source-search and set password as access-token when reque=
sted.
> The substitution only happens if one sets `auth' to `xoauth2' in
> your auth-source-entry.  It is expected that `token_url',
> `client_id', `client_secret', and `refresh_token' are properly
> set along `host', `user', and `port' (note the snake_case)."
>   (auth-source-do-trivia "Advising auth-source-search")
>   (let (check-secret)
>     (when (memq :secret (nth 5 args))
>       (auth-source-do-trivia
>        "Required fields include :secret.  As we are requesting access tok=
en to replace the secret, we'll temporary remove :secret from the require l=
ist and check that it's properly set to a valid access token later.")
>       (setf (nth 5 args) (remove :secret (nth 5 args)))
>       (setq check-secret t))
>     (let ((orig-res (apply orig-fun args))
>           res)
>       (dolist (auth-data orig-res)
>         (auth-source-do-trivia "Matched auth data: %s" (pp-to-string auth=
-data))

Is "trivia" the right debug level for all the messages in this function?
I feel like some of them should at least be "debug".

>         (let ((auth (plist-get auth-data :auth)))
>           (when (and auth
>                      (stringp auth)
>                      (string=3D auth "xoauth2"))

You can simplify the check by just doing (equal auth "xoauth2"), as this
implies all of the above (if it is `equal' to a string, it must be a
string and hence also non-nil).

>             (auth-source-do-debug
>              ":auth set to `xoauth2'.  Will get access token.")
>             (let ((auth-url (plist-get auth-data :auth-url))
>                   (token-url (plist-get auth-data :token-url))
>                   (scope (plist-get auth-data :scope))
>                   (client-id (plist-get auth-data :client-id))
>                   (client-secret (plist-get auth-data :client-secret))
>                   (redirect-uri (plist-get auth-data :redirect-uri))
>                   (state (plist-get auth-data :state)))

I feel like this could be simplified with a map-let expression.=20=20

  (map-let (:auth-url :token-url ...) auth-data
    ...)
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
You should be able to require 'map at compile time, so that the
expansions don't occur an overhead during run-time.

>               (auth-source-do-trivia "Using oauth2 to auth and store toke=
n...")
>               (let ((token (oauth2-auth-and-store
>                             auth-url token-url scope client-id client-sec=
ret
>                             redirect-uri state)))
>                 (auth-source-do-trivia "oauth2 token: %s" (pp-to-string t=
oken))
>                 (auth-source-do-trivia "Refreshing token...")
>                 (oauth2-refresh-access token)
>                 (auth-source-do-trivia "oauth2 token after refresh: %s"
>                                        (pp-to-string token))
>                 (let ((access-token (oauth2-token-access-token token)))
>                   (auth-source-do-trivia
>                    "Updating :secret with access-token: %s" access-token)
>                   (plist-put auth-data :secret access-token))))))

The documentation for plist-put warns:

  The new plist is returned;
  use =E2=80=98(setq x (plist-put x prop val))=E2=80=99 to be sure to use t=
he new value.
  The PLIST is modified by side effects.

Alternatively, you should also be able to do:

  (setf (plist-get auth-data :secret) access-token)

>
>         (unless (and check-secret
>                      (not (plist-get auth-data :secret)))
>           (auth-source-do-trivia "Updating auth-source-search results.")
>           (add-to-list 'res auth-data t)))

This should definitely be a `push', as `res' is lexically scoped (see
docstring for `add-to-list').

>       res)))
>
> ;;;###autoload
> (defun auth-source-xoauth2-plugin-enable ()
>   "Enable auth-source-xoauth2-plugin."
>   (unless (memq 'xoauth2 smtpmail-auth-supported)
>     (add-to-list 'smtpmail-auth-supported 'xoauth2))

In functions, it would be more conventional to use push.  Especially
because `add-to-list' checks for duplicates, which you have already
done.

>
>   (advice-add 'auth-source-search-backends :around

There's no reason not to sharp-quote the function here as well?

>               #'auth-source-xoauth2-plugin--search-backends))

I would recommend turning this into a global minor mode instead, so that
it is easy to disable, if a user just wants to try it out.

>
> (provide 'auth-source-xoauth2-plugin)
>
> ;;; auth-source-xoauth2-plugin.el ends here

--=20
	Philip Kaludercic on siskin




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 17 Sep 2024 17:34:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 17 13:34:41 2024
Received: from localhost ([127.0.0.1]:55874 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1sqc64-0001jI-Se
	for submit <at> debbugs.gnu.org; Tue, 17 Sep 2024 13:34:41 -0400
Received: from mail-pl1-f181.google.com ([209.85.214.181]:51433)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1sqc62-0001j3-Vu
 for 72992 <at> debbugs.gnu.org; Tue, 17 Sep 2024 13:34:39 -0400
Received: by mail-pl1-f181.google.com with SMTP id
 d9443c01a7336-20536dcc6e9so35164815ad.2
 for <72992 <at> debbugs.gnu.org>; Tue, 17 Sep 2024 10:34:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726594398; x=1727199198; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=a9SkM8YNNatKp0cBtj/eETOdYrhYjpaLGVjcyb9JQY8=;
 b=hnTbyqQ+sCVgBjmxec0ZLqEY7zmgUqHav41cqvWnutveR4+FkgtLY7GN4Zul/qYlhO
 L9QJ0Tjev+cgbhaofSCGDITPGoItRrsCKba7n8fSqHhceOMqJXhpRlcG8Wo/I9hXvXDX
 IIp89N25LpVo17Xd7uwSvolNBZeM4UVMm4qSEeQpmCoTaC9Y585nSAH8M9M6YfeK7tsm
 GCSEzNn01JxIddKbGFLmAjXxjQX0eVjb0xYmPvugh6WqVOaTDp+xc2e6QvcqKu0mCU4p
 XW9D4DnYDwioEV7YUvFP70E5L8VHhEpkRgOKmkpOF0uX3CutvxqhuRAV7iIpyHVWshZx
 2aLg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726594398; x=1727199198;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=a9SkM8YNNatKp0cBtj/eETOdYrhYjpaLGVjcyb9JQY8=;
 b=nAosAfslzjry9u5laqni0aS69ukI1zBc5lADuzRuXCPvMdA/lXSmWepyXApLd4IhnS
 I5S5OmWGhZWUux7A7p6ytxZP68Fg5nZ2dUAbvHuVKpqAuVI4ekurrZHXz06+XRwkW3Wa
 PeGIKY+We7QGgzBslO+/yaH70b+nxrNEwZo8tSQW9hgxrLKG/iUmYFpjEjWASDcBAtwI
 1mOieIWPb8H9nLbZ+S5aZJ8qZ8chuwqYv5Nuyj+8B0V6w/Y784qQQzHMr79FyN8V1Kcg
 vZB7HIzTXV2ZNDpkkzukxqREA/k6PjnH2No0PZrl3ba8Hp6NKCFQQdnPkSoKxOtIIgSm
 vu7w==
X-Gm-Message-State: AOJu0Yz1CS8zqrZgxCmLHF9LdHEhNSa5mI3tAyqrRGSsPLk7R8kvheXA
 Rr0EsKW6n7Metq1E0U0c5kTW7tsPheZy3xf/hve0vtUvdK4GhcQj
X-Google-Smtp-Source: AGHT+IHS6oQpeaq701vqDkvQVGrkLkzW+V/swjRff1C23yEDOHkuN9a6of33IDYrE14N7twZV5xK6Q==
X-Received: by 2002:a17:903:987:b0:206:ba20:dd40 with SMTP id
 d9443c01a7336-2078296a3e9mr233255235ad.27.1726594397873; 
 Tue, 17 Sep 2024 10:33:17 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d9443c01a7336-2079470f197sm52596935ad.233.2024.09.17.10.33.17
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 17 Sep 2024 10:33:17 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: 72992 <at> debbugs.gnu.org, Philip Kaludercic <philipk@HIDDEN>
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <878qvzqbko.fsf@HIDDEN>
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <handler.72992.B.172532159013230.ack <at> debbugs.gnu.org>
 <878qvzqbko.fsf@HIDDEN>
User-Agent: Notmuch/0.38.3 (https://notmuchmail.org) Emacs/29.4
 (x86_64-pc-linux-gnu)
Date: Tue, 17 Sep 2024 10:33:14 -0700
Message-ID: <877cbadw2t.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Xiyue Deng <manphiz@HIDDEN> writes:

> Friendly ping for feedback.
> -- 
> Xiyue Deng

Another friendly ping.  Also CCing Philip who kindly provided feedback
for the previous bug.

-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at 72992 <at> debbugs.gnu.org:


Received: (at 72992) by debbugs.gnu.org; 11 Sep 2024 00:28:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 10 20:28:36 2024
Received: from localhost ([127.0.0.1]:37186 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1soBDo-0004Lw-8E
	for submit <at> debbugs.gnu.org; Tue, 10 Sep 2024 20:28:36 -0400
Received: from mail-pg1-f170.google.com ([209.85.215.170]:56827)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1soBDn-0004LY-76
 for 72992 <at> debbugs.gnu.org; Tue, 10 Sep 2024 20:28:35 -0400
Received: by mail-pg1-f170.google.com with SMTP id
 41be03b00d2f7-7d916b6a73aso1824650a12.1
 for <72992 <at> debbugs.gnu.org>; Tue, 10 Sep 2024 17:28:29 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1726014443; x=1726619243; darn=debbugs.gnu.org;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=uLD309G5L3REaXu2fbLId38EJGZWcMPQyq+MLQ3zFoI=;
 b=PiOW3ieowYtk8Nl9bSJYxLlFniR3VhaOyqHhvXfX88Er37YHPGExxnzUUEi0ZVdpt9
 xuEHyfiPyqhDmgfFkk/VPGkuQfv62lYC2rb0Rd/IG3biAH5r+ZsZk1LIJv8YhsxIaYjk
 o8w27cW6ujzrSgXpvQXByG6t0mWibJ6bju87bpcE2HYQb/Ft39khHqZhu8sz4bi6zGLz
 u1v6MmrGYMhHw9Zgyd6VA51/ZZEjzzSVD7PXUM4YJWFse1fOhlh2XzAYxNnR8hH0d0FU
 c8GaD4ohQvPcpcQqjIjsSy+RPiLEMfmTSvcOXpaTS3yvViLGqpYk7Rguk2DtNhe6wji0
 oqKQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1726014443; x=1726619243;
 h=mime-version:message-id:date:user-agent:references:in-reply-to
 :subject:to:from:x-gm-message-state:from:to:cc:subject:date
 :message-id:reply-to;
 bh=uLD309G5L3REaXu2fbLId38EJGZWcMPQyq+MLQ3zFoI=;
 b=OTcAQ9ZCd6KYjQqSL9OyLpNGL9FXqs6ni6KqFSOIU1ZGvEFG7uqsEfCi45nXktdHKE
 5pH3ycD6QZIHQNXyL/9xAbi8L6cH5j3kkt9fLDtTRlkVUXFQhhgWVkGU31f0O4ohlnZD
 E0j5S9rwmTFZHHOXVckp6n+oaJEFB6PTBuymYJQ4lRtBpHXpDJ9PSV1Ad0SmvtnRBUrE
 m0JQZKhKBeoLJHdn3rlKh3R35R1uvALesiBhpKuAG+u5vYJFqVzv+FXZic6nfbSva/ty
 5DgSmMw63SnD9TTGjZ9R4bDFYkzok+qJqvzUo6PNrIzgTMyzF9iDG642fI2DA9HNDh4s
 ZTxw==
X-Gm-Message-State: AOJu0Ywcw0L2TlF7ZY258AXxWfh+8vVdqCPQ3XKdPgNy1+IJKnDFpl0F
 OS4+2k5i5vbYDwTENEcWC1KH2mH9Jfgtz8/69PZdoNdEvWLnN3+i5RLhpH+r
X-Google-Smtp-Source: AGHT+IHMTyz8T7IHPxFZkvFzZM+whGe+X+I6P1CsMgyK8F1Cu1B9OTDWnnGDYDkl0swR2mJL47jFDQ==
X-Received: by 2002:a05:6a21:3a81:b0:1cf:3838:1ed9 with SMTP id
 adf61e73a8af0-1cf5e19cf2dmr2620862637.50.1726014442815; 
 Tue, 10 Sep 2024 17:27:22 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 41be03b00d2f7-7d825ba6a92sm6155944a12.92.2024.09.10.17.27.22
 for <72992 <at> debbugs.gnu.org>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Tue, 10 Sep 2024 17:27:22 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: 72992 <at> debbugs.gnu.org
Subject: Re: bug#72992: 29.4; towards xoauth2 support in Emacs
In-Reply-To: <handler.72992.B.172532159013230.ack <at> debbugs.gnu.org> (GNU bug
 Tracking System's message of "Tue, 03 Sep 2024 00:00:02 +0000")
References: <87h6ayfo87.fsf_-_@HIDDEN>
 <handler.72992.B.172532159013230.ack <at> debbugs.gnu.org>
User-Agent: mu4e 1.12.6; emacs 29.4
Date: Tue, 10 Sep 2024 17:27:19 -0700
Message-ID: <878qvzqbko.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 72992
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

Friendly ping for feedback.
-- 
Xiyue Deng




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 2 Sep 2024 23:59:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Sep 02 19:59:50 2024
Received: from localhost ([127.0.0.1]:53101 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1slGxW-0003RF-WB
	for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 19:59:50 -0400
Received: from lists.gnu.org ([209.51.188.17]:35856)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <manphiz@HIDDEN>) id 1slGxR-0003R4-Vr
 for submit <at> debbugs.gnu.org; Mon, 02 Sep 2024 19:59:45 -0400
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 <manphiz@HIDDEN>) id 1slGwS-0005FI-80
 for bug-gnu-emacs@HIDDEN; Mon, 02 Sep 2024 19:58:40 -0400
Received: from mail-oo1-xc2e.google.com ([2607:f8b0:4864:20::c2e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <manphiz@HIDDEN>) id 1slGwN-0005dp-T5
 for bug-gnu-emacs@HIDDEN; Mon, 02 Sep 2024 19:58:40 -0400
Received: by mail-oo1-xc2e.google.com with SMTP id
 006d021491bc7-5df9dec9c0eso3154666eaf.2
 for <bug-gnu-emacs@HIDDEN>; Mon, 02 Sep 2024 16:58:35 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20230601; t=1725321514; x=1725926314; darn=gnu.org;
 h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc
 :subject:date:message-id:reply-to;
 bh=6lwvlh4rSJpYarA6xcrRBS9Yk2eJxE4OmrZw21tvCuY=;
 b=GT1zuIk95zm1rcLWQdHT3RZ0XEnYGm3KeWJI+st6qSAl1I6shL8K4WI0P/I0F3JP7Y
 Wgl8YgIsLrEazVunYNMGWs/w9CYMFnmhC5oMQ1J9TRzPXfaLWXKUoegaBWrFv+z3lN3+
 eQrvFrJR0rk98cAFOk7/Q+lirQUTz10Lza6v7HPV6LPHrUN13OrocrHR9wzrbeosbOuV
 9TsgCJTwXHL7nF9yDPPd1oXwCy+ctU+GwmGmV5+Sko2o1R3C+TuL1cpCpAfk1gglp4bF
 V+ogE2BI4ZLVPWDwLvX8122C9dhTTRn8Q2ayPMJ8p1BerbKtVm5N6IS3v4mE8rFFXlrt
 j7/A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1725321514; x=1725926314;
 h=mime-version:user-agent:message-id:date:subject:to:from
 :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
 bh=6lwvlh4rSJpYarA6xcrRBS9Yk2eJxE4OmrZw21tvCuY=;
 b=Ogo5tgHA8gS5pmVZCCdv7HN6qnkX0Mcqt26CExNL9F+z2nIm33cNxX7gauPJ+o2R0C
 j44v6G3vhZBGH1HFmisBEcSBA2PaHvBslNEjklATsOS4B31gNWUJ1Ojgmqsxnsetqasv
 gtaCET/WyU1zDM7dOoDHTnjv/QXv+LA7aijdHmsx2U7AUhSAUk3coTbZPBUCzx7LSMlO
 VYui2rtopdggLCMU4vUy1YWPjoxMNyjP7e+2ehEQCAjvBXvrIfFKV0FugfE+S/Wy/dQq
 YazCnCf3zje/g/0xX4Lbehwz2RySsZWG9EwpzOsmNdIh8Q5APSlEoK9H4xs4Jw3FBF7d
 iB+w==
X-Gm-Message-State: AOJu0YyJ0aGUGG2Q7ZVIMit3nXu12lHUCW7G3y8PymVuKF+DZy+wsUTz
 XRIYS0YWYFRxrzZHzn+fD9yu4Pp6lIcxpQD958YuFth6itwIY+KRGutSkTSzBIM=
X-Google-Smtp-Source: AGHT+IHzZtzU8zDRMACqsK8U6GcVcFSZ/DW5F+VnFMJTrSKerdilmDgGFpubFaqYTHZfJRLpiO4SYw==
X-Received: by 2002:a05:6870:d186:b0:277:fe10:2447 with SMTP id
 586e51a60fabf-277ffcefefdmr3571248fac.0.1725321512151; 
 Mon, 02 Sep 2024 16:58:32 -0700 (PDT)
Received: from debian-hx90 (syn-076-094-249-045.res.spectrum.com.
 [76.94.249.45]) by smtp.gmail.com with ESMTPSA id
 d2e1a72fcca58-715e55a453dsm7357727b3a.69.2024.09.02.16.58.31
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 02 Sep 2024 16:58:31 -0700 (PDT)
From: Xiyue Deng <manphiz@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: 29.4; towards xoauth2 support in Emacs
Date: Mon, 02 Sep 2024 01:34:32 -0700
Message-ID: <87h6ayfo87.fsf_-_@HIDDEN>
User-Agent: mu4e 1.12.6; emacs 29.4
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2607:f8b0:4864:20::c2e;
 envelope-from=manphiz@HIDDEN; helo=mail-oo1-xc2e.google.com
X-Spam_score_int: -10
X-Spam_score: -1.1
X-Spam_bar: -
X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_12_24=1.049,
 DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -0.5 (/)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.5 (-)

--=-=-=
Content-Type: text/plain

Now that bug#72358 is done, as promised, I'm posting my plugin for
auth-sources that enables oauth2 handling which you can find on
Gitlab[1] (also attached).  As the current approach tries to override
some existing handling in auth-source, I would like to gather some
comments on how to properly integrate this handling, and see if there is
any benefit on providing this as a separate package for older Emacs
versions.

In the comment section of the package I put notes on how xoauth2 is
enabled as well as existing restrictions in auth-source and how it
workarounds them.  I'll briefly explain below.

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.  Because xoauth2 also makes use of
`secret'/`password', it makes it hard to determine whether to use
password-based or xoauth2-based authentication, which is why my plugin
asks users to set `auth' in auth-source to determine whether to use
xoauth2.  Another complication from this is that auth-source search
requires the entry contains a `secret' most of the time, where it does
not need to be set when using xoauth2.  Therefore I workaround this by
temporarily disables this check and try to retrieve access-token using
oauth2 and set the result as password.

Given the inconveniences of reusing password for access-token, I wonder
whether we can add support for a separate `:access-token' key in the
auth-source entry and use that instead of password when authenticating
using xoauth2.  This way, we can have both password and access-token in
an auth-source entry and nnimap and smtpmail can use either one.  More
specifically:

* When performing an auth-source search, if xoauth2 related fields are
  set (see the list of fields in the comments of my plugin), it will
  retrieve access-token using oauth2.

* The search should change to check for either `secret'/`password' or
  `access-token' is available.

* For `nnimap-login' and `smtpmail-try-auth-method', pass in both
  password and access-token, and for xoauth2 it should use access-token
  instead of password.

If this is an acceptable approach, I'll try to draft a patch to
implement this in Emacs.  Otherwise, it may still worth implement the
current approach directly in Emacs so as to avoid using hack like
advice.

Meanwhile, I wonder whether this may be worth release as a separate
package so that users of older versions can use xoauth2 as well.  I'd
like to make it compatible with the agreed-upon approach to minimize any
incompatibilities.

Thanks for reading, and any comments are appreciated.

[1] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin


In GNU Emacs 29.4 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.38,
 cairo version 1.16.0) of 2024-07-02, modified by Debian built on
 debian-hx90
System Description: Debian GNU/Linux 12 (bookworm)

Configured using:
 'configure --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --build x86_64-linux-gnu --prefix=/usr
 --sharedstatedir=/var/lib --libexecdir=/usr/libexec
 --localstatedir=/var/lib --infodir=/usr/share/info
 --mandir=/usr/share/man --with-libsystemd --with-pop=yes
 --enable-locallisppath=/etc/emacs:/usr/local/share/emacs/29.4/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/29.4/site-lisp:/usr/share/emacs/site-lisp
 --with-sound=alsa --without-gconf --with-mailutils
 --with-native-compilation --with-cairo --with-x=yes
 --with-x-toolkit=gtk3 --with-toolkit-scroll-bars 'CFLAGS=-g -O2
 -ffile-prefix-map=/build/emacs-UNWIcy/emacs-29.4+1=. -fstack-protector-strong
 -Wformat -Werror=format-security -Wall' 'CPPFLAGS=-Wdate-time
 -D_FORTIFY_SOURCE=2' LDFLAGS=-Wl,-z,relro'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3
THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2
XPM GTK3 ZLIB

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  global-git-commit-mode: t
  magit-auto-revert-mode: t
  shell-dirtrack-mode: t
  mu4e-modeline-mode: t
  windmove-mode: t
  rcirc-track-minor-mode: t
  server-mode: t
  subword-mode: t
  bug-reference-prog-mode: t
  whitespace-mode: t
  yas-minor-mode: t
  xclip-mode: t
  global-treesit-auto-mode: t
  treemacs-project-follow-mode: t
  treemacs-follow-mode: t
  treemacs-git-mode: t
  treemacs-fringe-indicator-mode: t
  corfu-terminal-mode: t
  corfu-popupinfo-mode: t
  corfu-echo-mode: t
  global-corfu-mode: t
  corfu-mode: t
  activities-tabs-mode: t
  activities-mode: t
  fido-vertical-mode: t
  icomplete-vertical-mode: t
  icomplete-mode: t
  fido-mode: t
  override-global-mode: t
  global-display-line-numbers-mode: t
  display-line-numbers-mode: t
  global-auto-revert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-autoloads hides /usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/debian-autoloads
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-section hides /usr/share/emacs/site-lisp/elpa/magit-section-3.3.0/magit-section
/usr/share/emacs/site-lisp/elpa/ace-window-0.10.0/ace-window-autoloads hides /usr/share/emacs/site-lisp/elpa-src/ace-window-0.10.0/ace-window-autoloads
/usr/share/emacs/site-lisp/elpa/ace-window-0.10.0/ace-window-pkg hides /usr/share/emacs/site-lisp/elpa-src/ace-window-0.10.0/ace-window-pkg
/usr/share/emacs/site-lisp/elpa/ace-window-0.10.0/ace-window hides /usr/share/emacs/site-lisp/elpa-src/ace-window-0.10.0/ace-window
/usr/share/emacs/site-lisp/elpa/activities-0.7.1/activities-autoloads hides /usr/share/emacs/site-lisp/elpa-src/activities-0.7.1/activities-autoloads
/usr/share/emacs/site-lisp/elpa/activities-0.7.1/activities-pkg hides /usr/share/emacs/site-lisp/elpa-src/activities-0.7.1/activities-pkg
/usr/share/emacs/site-lisp/elpa/activities-0.7.1/activities-list hides /usr/share/emacs/site-lisp/elpa-src/activities-0.7.1/activities-list
/usr/share/emacs/site-lisp/elpa/activities-0.7.1/activities hides /usr/share/emacs/site-lisp/elpa-src/activities-0.7.1/activities
/usr/share/emacs/site-lisp/elpa/activities-0.7.1/activities-tabs hides /usr/share/emacs/site-lisp/elpa-src/activities-0.7.1/activities-tabs
/usr/share/emacs/site-lisp/elpa/apache-mode-2.2.0/apache-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/apache-mode-2.2.0/apache-mode-autoloads
/usr/share/emacs/site-lisp/elpa/apache-mode-2.2.0/apache-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/apache-mode-2.2.0/apache-mode-pkg
/usr/share/emacs/site-lisp/elpa/apache-mode-2.2.0/apache-mode hides /usr/share/emacs/site-lisp/elpa-src/apache-mode-2.2.0/apache-mode
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-info hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-info
/usr/share/emacs/site-lisp/elpa/auctex-13.3/latex-flymake hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/latex-flymake
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-site hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-site
/usr/share/emacs/site-lisp/elpa/auctex-13.3/texmathp hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/texmathp
/usr/share/emacs/site-lisp/elpa/auctex-13.3/toolbar-x hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/toolbar-x
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-style hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-style
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-font hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-font
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-jp hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-jp
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-mik hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-mik
/usr/share/emacs/site-lisp/elpa/auctex-13.3/plain-tex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/plain-tex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-fold hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-fold
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-ispell hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-ispell
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-bar hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-bar
/usr/share/emacs/site-lisp/elpa/auctex-13.3/preview-latex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/preview-latex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/bib-cite hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/bib-cite
/usr/share/emacs/site-lisp/elpa/auctex-13.3/preview hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/preview
/usr/share/emacs/site-lisp/elpa/auctex-13.3/context-nl hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/context-nl
/usr/share/emacs/site-lisp/elpa/auctex-13.3/auto-loads hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/auto-loads
/usr/share/emacs/site-lisp/elpa/auctex-13.3/multi-prompt hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/multi-prompt
/usr/share/emacs/site-lisp/elpa/auctex-13.3/context-en hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/context-en
/usr/share/emacs/site-lisp/elpa/auctex-13.3/lpath hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/lpath
/usr/share/emacs/site-lisp/elpa/auctex-13.3/auctex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/auctex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/auctex-autoloads hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/auctex-autoloads
/usr/share/emacs/site-lisp/elpa/auctex-13.3/font-latex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/font-latex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/auctex-pkg hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/auctex-pkg
/usr/share/emacs/site-lisp/elpa/auctex-13.3/context hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/context
/usr/share/emacs/site-lisp/elpa/auctex-13.3/latex hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/latex
/usr/share/emacs/site-lisp/elpa/auctex-13.3/tex-wizard hides /usr/share/emacs/site-lisp/elpa-src/auctex-13.3/tex-wizard
/usr/share/emacs/site-lisp/elpa/avy-0.5.0/avy hides /usr/share/emacs/site-lisp/elpa-src/avy-0.5.0/avy
/usr/share/emacs/site-lisp/elpa/avy-0.5.0/avy-autoloads hides /usr/share/emacs/site-lisp/elpa-src/avy-0.5.0/avy-autoloads
/usr/share/emacs/site-lisp/elpa/avy-0.5.0/avy-pkg hides /usr/share/emacs/site-lisp/elpa-src/avy-0.5.0/avy-pkg
/usr/share/emacs/site-lisp/elpa/bazel-0/bazel-autoloads hides /usr/share/emacs/site-lisp/elpa-src/bazel-0/bazel-autoloads
/usr/share/emacs/site-lisp/elpa/bazel-0/bazel hides /usr/share/emacs/site-lisp/elpa-src/bazel-0/bazel
/usr/share/emacs/site-lisp/elpa/bazel-0/test hides /usr/share/emacs/site-lisp/elpa-src/bazel-0/test
/usr/share/emacs/site-lisp/elpa/bazel-0/bazel-pkg hides /usr/share/emacs/site-lisp/elpa-src/bazel-0/bazel-pkg
/usr/share/emacs/site-lisp/elpa/bison-mode-0.3/bison-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/bison-mode-0.3/bison-mode-pkg
/usr/share/emacs/site-lisp/elpa/bison-mode-0.3/bison-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/bison-mode-0.3/bison-mode-autoloads
/usr/share/emacs/site-lisp/elpa/bison-mode-0.3/bison-mode hides /usr/share/emacs/site-lisp/elpa-src/bison-mode-0.3/bison-mode
/usr/share/emacs/site-lisp/elpa/boxquote-2.3/boxquote hides /usr/share/emacs/site-lisp/elpa-src/boxquote-2.3/boxquote
/usr/share/emacs/site-lisp/elpa/boxquote-2.3/boxquote-autoloads hides /usr/share/emacs/site-lisp/elpa-src/boxquote-2.3/boxquote-autoloads
/usr/share/emacs/site-lisp/elpa/boxquote-2.3/boxquote-pkg hides /usr/share/emacs/site-lisp/elpa-src/boxquote-2.3/boxquote-pkg
/usr/share/emacs/site-lisp/elpa/buttercup-1.26/buttercup-pkg hides /usr/share/emacs/site-lisp/elpa-src/buttercup-1.26/buttercup-pkg
/usr/share/emacs/site-lisp/elpa/buttercup-1.26/buttercup hides /usr/share/emacs/site-lisp/elpa-src/buttercup-1.26/buttercup
/usr/share/emacs/site-lisp/elpa/buttercup-1.26/buttercup-autoloads hides /usr/share/emacs/site-lisp/elpa-src/buttercup-1.26/buttercup-autoloads
/usr/share/emacs/site-lisp/elpa/buttercup-1.26/buttercup-compat hides /usr/share/emacs/site-lisp/elpa-src/buttercup-1.26/buttercup-compat
/usr/share/emacs/site-lisp/elpa/cfrs-1.6.0/cfrs-pkg hides /usr/share/emacs/site-lisp/elpa-src/cfrs-1.6.0/cfrs-pkg
/usr/share/emacs/site-lisp/elpa/cfrs-1.6.0/cfrs hides /usr/share/emacs/site-lisp/elpa-src/cfrs-1.6.0/cfrs
/usr/share/emacs/site-lisp/elpa/cfrs-1.6.0/cfrs-autoloads hides /usr/share/emacs/site-lisp/elpa-src/cfrs-1.6.0/cfrs-autoloads
/usr/share/emacs/site-lisp/elpa/clojure-mode-5.19.0/clojure-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-5.19.0/clojure-mode-pkg
/usr/share/emacs/site-lisp/elpa/clojure-mode-5.19.0/clojure-mode hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-5.19.0/clojure-mode
/usr/share/emacs/site-lisp/elpa/clojure-mode-5.19.0/clojure-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-5.19.0/clojure-mode-autoloads
/usr/share/emacs/site-lisp/elpa/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking-pkg hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking-pkg
/usr/share/emacs/site-lisp/elpa/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking-autoloads hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking-autoloads
/usr/share/emacs/site-lisp/elpa/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking hides /usr/share/emacs/site-lisp/elpa-src/clojure-mode-extra-font-locking-3.0.0/clojure-mode-extra-font-locking
/usr/share/emacs/site-lisp/elpa/cmake-mode-3.29.0/cmake-mode hides /usr/share/emacs/site-lisp/elpa-src/cmake-mode-3.29.0/cmake-mode
/usr/share/emacs/site-lisp/elpa/cmake-mode-3.29.0/cmake-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/cmake-mode-3.29.0/cmake-mode-autoloads
/usr/share/emacs/site-lisp/elpa/cmake-mode-3.29.0/cmake-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/cmake-mode-3.29.0/cmake-mode-pkg
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-dabbrev hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-dabbrev
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-capf hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-capf
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-yasnippet hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-yasnippet
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-ispell hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-ispell
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-etags hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-etags
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-template hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-template
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-abbrev hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-abbrev
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-files hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-files
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-css hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-css
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-tests hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-tests
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-dabbrev-code hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-dabbrev-code
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-pkg hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-pkg
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-oddmuse hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-oddmuse
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-bbdb hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-bbdb
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-clang hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-clang
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-nxml hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-nxml
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-gtags hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-gtags
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-tempo hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-tempo
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-autoloads hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-autoloads
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-cmake hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-cmake
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-tng hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-tng
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-elisp hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-elisp
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-semantic hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-semantic
/usr/share/emacs/site-lisp/elpa/company-0.10.2/company-keywords hides /usr/share/emacs/site-lisp/elpa-src/company-0.10.2/company-keywords
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-26 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-26
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-28 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-28
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-macs hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-macs
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-autoloads hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-autoloads
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-pkg hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-pkg
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-25 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-25
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-30 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-30
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-29 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-29
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat-27 hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat-27
/usr/share/emacs/site-lisp/elpa/compat-30.0.0.0/compat hides /usr/share/emacs/site-lisp/elpa-src/compat-30.0.0.0/compat
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-quick hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-quick
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-info hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-info
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-history hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-history
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-popupinfo hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-popupinfo
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-indexed hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-indexed
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-pkg hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-pkg
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-echo hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-echo
/usr/share/emacs/site-lisp/elpa/corfu-1.5/corfu-autoloads hides /usr/share/emacs/site-lisp/elpa-src/corfu-1.5/corfu-autoloads
/usr/share/emacs/site-lisp/elpa/corfu-terminal-0.7/corfu-terminal-autoloads hides /usr/share/emacs/site-lisp/elpa-src/corfu-terminal-0.7/corfu-terminal-autoloads
/usr/share/emacs/site-lisp/elpa/corfu-terminal-0.7/corfu-terminal-pkg hides /usr/share/emacs/site-lisp/elpa-src/corfu-terminal-0.7/corfu-terminal-pkg
/usr/share/emacs/site-lisp/elpa/corfu-terminal-0.7/corfu-terminal hides /usr/share/emacs/site-lisp/elpa-src/corfu-terminal-0.7/corfu-terminal
/usr/share/emacs/site-lisp/elpa/csv-mode-1.23/csv-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/csv-mode-1.23/csv-mode-autoloads
/usr/share/emacs/site-lisp/elpa/csv-mode-1.23/csv-mode hides /usr/share/emacs/site-lisp/elpa-src/csv-mode-1.23/csv-mode
/usr/share/emacs/site-lisp/elpa/csv-mode-1.23/csv-mode-tests hides /usr/share/emacs/site-lisp/elpa-src/csv-mode-1.23/csv-mode-tests
/usr/share/emacs/site-lisp/elpa/csv-mode-1.23/csv-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/csv-mode-1.23/csv-mode-pkg
/usr/share/emacs/site-lisp/elpa/dart-mode-1.0.7/dart-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/dart-mode-1.0.7/dart-mode-autoloads
/usr/share/emacs/site-lisp/elpa/dart-mode-1.0.7/dart-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/dart-mode-1.0.7/dart-mode-pkg
/usr/share/emacs/site-lisp/elpa/dart-mode-1.0.7/dart-mode hides /usr/share/emacs/site-lisp/elpa-src/dart-mode-1.0.7/dart-mode
/usr/share/emacs/site-lisp/elpa/dash-2.19.1/dash hides /usr/share/emacs/site-lisp/elpa-src/dash-2.19.1/dash
/usr/share/emacs/site-lisp/elpa/dash-2.19.1/dash-pkg hides /usr/share/emacs/site-lisp/elpa-src/dash-2.19.1/dash-pkg
/usr/share/emacs/site-lisp/elpa/dash-2.19.1/dash-autoloads hides /usr/share/emacs/site-lisp/elpa-src/dash-2.19.1/dash-autoloads
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-el-autoloads hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/debian-el-autoloads
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/apt-sources hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/apt-sources
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-bug hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/debian-bug
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/apt-utils hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/apt-utils
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-el-pkg hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/debian-el-pkg
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-autoloads hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/debian-autoloads
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/gnus-BTS hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/gnus-BTS
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/deb-view hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/deb-view
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-el hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/debian-el
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/preseed hides /usr/share/emacs/site-lisp/elpa-src/debian-el-37.16/preseed
/usr/share/emacs/site-lisp/elpa/debpaste-0.1.5/debpaste hides /usr/share/emacs/site-lisp/elpa-src/debpaste-0.1.5/debpaste
/usr/share/emacs/site-lisp/elpa/debpaste-0.1.5/debpaste-pkg hides /usr/share/emacs/site-lisp/elpa-src/debpaste-0.1.5/debpaste-pkg
/usr/share/emacs/site-lisp/elpa/debpaste-0.1.5/debpaste-autoloads hides /usr/share/emacs/site-lisp/elpa-src/debpaste-0.1.5/debpaste-autoloads
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts-autoloads hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts-autoloads
/usr/share/emacs/site-lisp/elpa/devscripts-40/pbuilder-mode hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/pbuilder-mode
/usr/share/emacs/site-lisp/elpa/devscripts-40/devscripts-pkg hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/devscripts-pkg
/usr/share/emacs/site-lisp/elpa/devscripts-40/pbuilder-log-view-mode hides /usr/share/emacs/site-lisp/elpa-src/devscripts-40/pbuilder-log-view-mode
/usr/share/emacs/site-lisp/elpa/dockerfile-mode-1.7/dockerfile-mode hides /usr/share/emacs/site-lisp/elpa-src/dockerfile-mode-1.7/dockerfile-mode
/usr/share/emacs/site-lisp/elpa/dockerfile-mode-1.7/dockerfile-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/dockerfile-mode-1.7/dockerfile-mode-autoloads
/usr/share/emacs/site-lisp/elpa/dockerfile-mode-1.7/dockerfile-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/dockerfile-mode-1.7/dockerfile-mode-pkg
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/debian-bts-control hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/debian-bts-control
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/debian-changelog-mode hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/debian-changelog-mode
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/debian-autopkgtest-control-mode hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/debian-autopkgtest-control-mode
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/dpkg-dev-el-autoloads hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/dpkg-dev-el-autoloads
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/dpkg-dev-el-pkg hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/dpkg-dev-el-pkg
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/dpkg-dev-el hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/dpkg-dev-el
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/debian-control-mode hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/debian-control-mode
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/debian-copyright hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/debian-copyright
/usr/share/emacs/site-lisp/elpa/dpkg-dev-el-37.16/readme-debian hides /usr/share/emacs/site-lisp/elpa-src/dpkg-dev-el-37.16/readme-debian
/usr/share/emacs/site-lisp/elpa/exec-path-from-shell-2.1/exec-path-from-shell hides /usr/share/emacs/site-lisp/elpa-src/exec-path-from-shell-2.1/exec-path-from-shell
/usr/share/emacs/site-lisp/elpa/exec-path-from-shell-2.1/exec-path-from-shell-autoloads hides /usr/share/emacs/site-lisp/elpa-src/exec-path-from-shell-2.1/exec-path-from-shell-autoloads
/usr/share/emacs/site-lisp/elpa/exec-path-from-shell-2.1/exec-path-from-shell-pkg hides /usr/share/emacs/site-lisp/elpa-src/exec-path-from-shell-2.1/exec-path-from-shell-pkg
/usr/share/emacs/site-lisp/elpa/format-all-0.6.0/format-all hides /usr/share/emacs/site-lisp/elpa-src/format-all-0.6.0/format-all
/usr/share/emacs/site-lisp/elpa/format-all-0.6.0/format-all-pkg hides /usr/share/emacs/site-lisp/elpa-src/format-all-0.6.0/format-all-pkg
/usr/share/emacs/site-lisp/elpa/format-all-0.6.0/format-all-autoloads hides /usr/share/emacs/site-lisp/elpa-src/format-all-0.6.0/format-all-autoloads
/usr/share/emacs/site-lisp/elpa/git-commit-3.3.0/git-commit hides /usr/share/emacs/site-lisp/elpa-src/git-commit-3.3.0/git-commit
/usr/share/emacs/site-lisp/elpa/git-commit-3.3.0/git-commit-autoloads hides /usr/share/emacs/site-lisp/elpa-src/git-commit-3.3.0/git-commit-autoloads
/usr/share/emacs/site-lisp/elpa/git-commit-3.3.0/git-commit-pkg hides /usr/share/emacs/site-lisp/elpa-src/git-commit-3.3.0/git-commit-pkg
/usr/share/emacs/site-lisp/elpa/git-modes-1.4.2/git-modes hides /usr/share/emacs/site-lisp/elpa-src/git-modes-1.4.2/git-modes
/usr/share/emacs/site-lisp/elpa/git-modes-1.4.2/git-modes-pkg hides /usr/share/emacs/site-lisp/elpa-src/git-modes-1.4.2/git-modes-pkg
/usr/share/emacs/site-lisp/elpa/git-modes-1.4.2/git-modes-autoloads hides /usr/share/emacs/site-lisp/elpa-src/git-modes-1.4.2/git-modes-autoloads
/usr/share/emacs/site-lisp/elpa/gitattributes-mode-1.4.2/gitattributes-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/gitattributes-mode-1.4.2/gitattributes-mode-pkg
/usr/share/emacs/site-lisp/elpa/gitattributes-mode-1.4.2/gitattributes-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/gitattributes-mode-1.4.2/gitattributes-mode-autoloads
/usr/share/emacs/site-lisp/elpa/gitattributes-mode-1.4.2/gitattributes-mode hides /usr/share/emacs/site-lisp/elpa-src/gitattributes-mode-1.4.2/gitattributes-mode
/usr/share/emacs/site-lisp/elpa/gitconfig-mode-1.4.2/gitconfig-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/gitconfig-mode-1.4.2/gitconfig-mode-autoloads
/usr/share/emacs/site-lisp/elpa/gitconfig-mode-1.4.2/gitconfig-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/gitconfig-mode-1.4.2/gitconfig-mode-pkg
/usr/share/emacs/site-lisp/elpa/gitconfig-mode-1.4.2/gitconfig-mode hides /usr/share/emacs/site-lisp/elpa-src/gitconfig-mode-1.4.2/gitconfig-mode
/usr/share/emacs/site-lisp/elpa/gitignore-mode-1.4.2/gitignore-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/gitignore-mode-1.4.2/gitignore-mode-pkg
/usr/share/emacs/site-lisp/elpa/gitignore-mode-1.4.2/gitignore-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/gitignore-mode-1.4.2/gitignore-mode-autoloads
/usr/share/emacs/site-lisp/elpa/gitignore-mode-1.4.2/gitignore-mode hides /usr/share/emacs/site-lisp/elpa-src/gitignore-mode-1.4.2/gitignore-mode
/usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/gnuplot hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/gnuplot
/usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/gnuplot-autoloads hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/gnuplot-autoloads
/usr/share/emacs/site-lisp/elpa/debian-el-37.16/debian-autoloads hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/debian-autoloads
/usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/gnuplot-pkg hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/gnuplot-pkg
/usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/gnuplot-context hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/gnuplot-context
/usr/share/emacs/site-lisp/elpa/gnuplot-0.8.1/gnuplot-gui hides /usr/share/emacs/site-lisp/elpa-src/gnuplot-0.8.1/gnuplot-gui
/usr/share/emacs/site-lisp/elpa/go-mode-1.6.0/go-mode hides /usr/share/emacs/site-lisp/elpa-src/go-mode-1.6.0/go-mode
/usr/share/emacs/site-lisp/elpa/go-mode-1.6.0/go-guru hides /usr/share/emacs/site-lisp/elpa-src/go-mode-1.6.0/go-guru
/usr/share/emacs/site-lisp/elpa/go-mode-1.6.0/go-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/go-mode-1.6.0/go-mode-pkg
/usr/share/emacs/site-lisp/elpa/go-mode-1.6.0/go-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/go-mode-1.6.0/go-mode-autoloads
/usr/share/emacs/site-lisp/elpa/go-mode-1.6.0/go-rename hides /usr/share/emacs/site-lisp/elpa-src/go-mode-1.6.0/go-rename
/usr/share/emacs/site-lisp/elpa/graphviz-dot-mode-0.4.2/graphviz-dot-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/graphviz-dot-mode-0.4.2/graphviz-dot-mode-autoloads
/usr/share/emacs/site-lisp/elpa/graphviz-dot-mode-0.4.2/graphviz-dot-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/graphviz-dot-mode-0.4.2/graphviz-dot-mode-pkg
/usr/share/emacs/site-lisp/elpa/graphviz-dot-mode-0.4.2/graphviz-dot-mode hides /usr/share/emacs/site-lisp/elpa-src/graphviz-dot-mode-0.4.2/graphviz-dot-mode
/usr/share/emacs/site-lisp/elpa/ht-2.3/ht-pkg hides /usr/share/emacs/site-lisp/elpa-src/ht-2.3/ht-pkg
/usr/share/emacs/site-lisp/elpa/ht-2.3/ht-autoloads hides /usr/share/emacs/site-lisp/elpa-src/ht-2.3/ht-autoloads
/usr/share/emacs/site-lisp/elpa/ht-2.3/ht hides /usr/share/emacs/site-lisp/elpa-src/ht-2.3/ht
/usr/share/emacs/site-lisp/elpa/hydra-0.15.0/hydra-ox hides /usr/share/emacs/site-lisp/elpa-src/hydra-0.15.0/hydra-ox
/usr/share/emacs/site-lisp/elpa/hydra-0.15.0/hydra-autoloads hides /usr/share/emacs/site-lisp/elpa-src/hydra-0.15.0/hydra-autoloads
/usr/share/emacs/site-lisp/elpa/hydra-0.15.0/hydra-pkg hides /usr/share/emacs/site-lisp/elpa-src/hydra-0.15.0/hydra-pkg
/usr/share/emacs/site-lisp/elpa/hydra-0.15.0/hydra-examples hides /usr/share/emacs/site-lisp/elpa-src/hydra-0.15.0/hydra-examples
/usr/share/emacs/site-lisp/elpa/hydra-0.15.0/hydra hides /usr/share/emacs/site-lisp/elpa-src/hydra-0.15.0/hydra
/usr/share/emacs/site-lisp/elpa/inheritenv-0.2/inheritenv hides /usr/share/emacs/site-lisp/elpa-src/inheritenv-0.2/inheritenv
/usr/share/emacs/site-lisp/elpa/inheritenv-0.2/inheritenv-autoloads hides /usr/share/emacs/site-lisp/elpa-src/inheritenv-0.2/inheritenv-autoloads
/usr/share/emacs/site-lisp/elpa/inheritenv-0.2/inheritenv-pkg hides /usr/share/emacs/site-lisp/elpa-src/inheritenv-0.2/inheritenv-pkg
/usr/share/emacs/site-lisp/elpa/inheritenv-0.2/inheritenv-tests hides /usr/share/emacs/site-lisp/elpa-src/inheritenv-0.2/inheritenv-tests
/usr/share/emacs/site-lisp/elpa/language-id-0.20/language-id hides /usr/share/emacs/site-lisp/elpa-src/language-id-0.20/language-id
/usr/share/emacs/site-lisp/elpa/language-id-0.20/language-id-pkg hides /usr/share/emacs/site-lisp/elpa-src/language-id-0.20/language-id-pkg
/usr/share/emacs/site-lisp/elpa/language-id-0.20/language-id-autoloads hides /usr/share/emacs/site-lisp/elpa-src/language-id-0.20/language-id-autoloads
/usr/share/emacs/site-lisp/elpa/lintian-0.1/lintian-pkg hides /usr/share/emacs/site-lisp/elpa-src/lintian-0.1/lintian-pkg
/usr/share/emacs/site-lisp/elpa/lintian-0.1/lintian-autoloads hides /usr/share/emacs/site-lisp/elpa-src/lintian-0.1/lintian-autoloads
/usr/share/emacs/site-lisp/elpa/lintian-0.1/lintian hides /usr/share/emacs/site-lisp/elpa-src/lintian-0.1/lintian
/usr/share/emacs/site-lisp/elpa/lua-mode-20221027/lua-mode hides /usr/share/emacs/site-lisp/elpa-src/lua-mode-20221027/lua-mode
/usr/share/emacs/site-lisp/elpa/lua-mode-20221027/lua-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/lua-mode-20221027/lua-mode-autoloads
/usr/share/emacs/site-lisp/elpa/lua-mode-20221027/init-tryout hides /usr/share/emacs/site-lisp/elpa-src/lua-mode-20221027/init-tryout
/usr/share/emacs/site-lisp/elpa/lua-mode-20221027/lua-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/lua-mode-20221027/lua-mode-pkg
/usr/share/emacs/site-lisp/elpa/lv-0.15.0/lv-autoloads hides /usr/share/emacs/site-lisp/elpa-src/lv-0.15.0/lv-autoloads
/usr/share/emacs/site-lisp/elpa/lv-0.15.0/lv hides /usr/share/emacs/site-lisp/elpa-src/lv-0.15.0/lv
/usr/share/emacs/site-lisp/elpa/lv-0.15.0/lv-pkg hides /usr/share/emacs/site-lisp/elpa-src/lv-0.15.0/lv-pkg
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-remote hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-remote
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/git-rebase hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/git-rebase
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-bisect hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-bisect
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-margin hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-margin
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-merge hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-merge
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-section hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-section
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-patch hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-patch
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-commit hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-commit
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-autoloads hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-autoloads
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-files hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-files
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-stash hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-stash
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-bookmark hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-bookmark
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-submodule hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-submodule
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-apply hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-apply
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-repos hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-repos
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-core hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-core
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-subtree hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-subtree
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-autorevert hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-autorevert
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-gitignore hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-gitignore
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-transient hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-transient
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-extras hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-extras
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-git hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-git
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-notes hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-notes
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-reflog hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-reflog
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-mode hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-mode
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-push hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-push
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-tag hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-tag
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-process hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-process
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-ediff hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-ediff
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-imenu hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-imenu
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-diff hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-diff
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-clone hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-clone
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-log hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-log
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-utils hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-utils
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-wip hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-wip
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-branch hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-branch
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-pull hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-pull
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-reset hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-reset
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-sequence hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-sequence
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-status hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-status
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-refs hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-refs
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-obsolete hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-obsolete
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-fetch hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-fetch
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-worktree hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-worktree
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-blame hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-blame
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-pkg hides /usr/share/emacs/site-lisp/elpa-src/magit-3.3.0/magit-pkg
/usr/share/emacs/site-lisp/elpa/magit-section-3.3.0/magit-section-autoloads hides /usr/share/emacs/site-lisp/elpa-src/magit-section-3.3.0/magit-section-autoloads
/usr/share/emacs/site-lisp/elpa/magit-3.3.0/magit-section hides /usr/share/emacs/site-lisp/elpa-src/magit-section-3.3.0/magit-section
/usr/share/emacs/site-lisp/elpa/magit-section-3.3.0/magit-section-pkg hides /usr/share/emacs/site-lisp/elpa-src/magit-section-3.3.0/magit-section-pkg
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-cgen hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-cgen
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-scan hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-scan
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-publish hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-publish
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-complete hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-complete
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-syntax hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-syntax
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/tlc hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/tlc
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-netshell hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-netshell
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/semantic-matlab hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/semantic-matlab
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/mlint hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/mlint
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/company-matlab-shell hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/company-matlab-shell
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-shell-gud hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-shell-gud
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/mlgud hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/mlgud
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/srecode-matlab hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/srecode-matlab
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-compat hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-compat
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-mode-pkg
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-maint hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-maint
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/cedet-matlab hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/cedet-matlab
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-topic hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-topic
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/linemark hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/linemark
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-shell hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-shell
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/semanticdb-matlab hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/semanticdb-matlab
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-load hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-load
/usr/share/emacs/site-lisp/elpa/matlab-mode-4.0/matlab-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/matlab-mode-4.0/matlab-mode-autoloads
/usr/share/emacs/site-lisp/elpa/meson-mode-0.2/meson-mode hides /usr/share/emacs/site-lisp/elpa-src/meson-mode-0.2/meson-mode
/usr/share/emacs/site-lisp/elpa/meson-mode-0.2/utils hides /usr/share/emacs/site-lisp/elpa-src/meson-mode-0.2/utils
/usr/share/emacs/site-lisp/elpa/meson-mode-0.2/meson-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/meson-mode-0.2/meson-mode-autoloads
/usr/share/emacs/site-lisp/elpa/meson-mode-0.2/meson-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/meson-mode-0.2/meson-mode-pkg
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-draft hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-draft
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-modeline hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-modeline
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-view hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-view
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-message hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-message
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-helpers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-helpers
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-pkg hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-pkg
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-bookmarks hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-bookmarks
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-thread hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-thread
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-mime-parts hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-mime-parts
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-server hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-server
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-query-items hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-query-items
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-contrib hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-contrib
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-window hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-window
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-config hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-config
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-autoloads hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-autoloads
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-icalendar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-icalendar
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-mark hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-mark
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-headers hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-headers
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-org hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-org
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-contacts hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-contacts
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-speedbar hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-speedbar
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-obsolete hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-obsolete
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-vars hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-vars
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-actions hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-actions
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-main hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-main
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-search hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-search
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-notification hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-notification
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-context hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-context
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-compose hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-compose
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-lists hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-lists
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-folders hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-folders
/usr/share/emacs/site-lisp/elpa/mu4e-1.12.6/mu4e-update hides /usr/share/emacs/site-lisp/elpa-src/mu4e-1.12.6/mu4e-update
/usr/share/emacs/site-lisp/elpa/nginx-mode-1.1.9/nginx-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/nginx-mode-1.1.9/nginx-mode-autoloads
/usr/share/emacs/site-lisp/elpa/nginx-mode-1.1.9/nginx-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/nginx-mode-1.1.9/nginx-mode-pkg
/usr/share/emacs/site-lisp/elpa/nginx-mode-1.1.9/nginx-mode hides /usr/share/emacs/site-lisp/elpa-src/nginx-mode-1.1.9/nginx-mode
/usr/share/emacs/site-lisp/elpa/paredit-26/paredit-autoloads hides /usr/share/emacs/site-lisp/elpa-src/paredit-26/paredit-autoloads
/usr/share/emacs/site-lisp/elpa/paredit-26/paredit-pkg hides /usr/share/emacs/site-lisp/elpa-src/paredit-26/paredit-pkg
/usr/share/emacs/site-lisp/elpa/paredit-26/paredit hides /usr/share/emacs/site-lisp/elpa-src/paredit-26/paredit
/usr/share/emacs/site-lisp/elpa/persist-0.6.1/persist hides /usr/share/emacs/site-lisp/elpa-src/persist-0.6.1/persist
/usr/share/emacs/site-lisp/elpa/persist-0.6.1/persist-pkg hides /usr/share/emacs/site-lisp/elpa-src/persist-0.6.1/persist-pkg
/usr/share/emacs/site-lisp/elpa/persist-0.6.1/persist-autoloads hides /usr/share/emacs/site-lisp/elpa-src/persist-0.6.1/persist-autoloads
/usr/share/emacs/site-lisp/elpa/pfuture-1.9/pfuture hides /usr/share/emacs/site-lisp/elpa-src/pfuture-1.9/pfuture
/usr/share/emacs/site-lisp/elpa/pfuture-1.9/pfuture-autoloads hides /usr/share/emacs/site-lisp/elpa-src/pfuture-1.9/pfuture-autoloads
/usr/share/emacs/site-lisp/elpa/pfuture-1.9/pfuture-pkg hides /usr/share/emacs/site-lisp/elpa-src/pfuture-1.9/pfuture-pkg
/usr/share/emacs/site-lisp/elpa/po-mode-0.21/po-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.21/po-mode-pkg
/usr/share/emacs/site-lisp/elpa/po-mode-0.21/po-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.21/po-mode-autoloads
/usr/share/emacs/site-lisp/elpa/po-mode-0.21/po-mode hides /usr/share/emacs/site-lisp/elpa-src/po-mode-0.21/po-mode
/usr/share/emacs/site-lisp/elpa/popon-0.13/popon hides /usr/share/emacs/site-lisp/elpa-src/popon-0.13/popon
/usr/share/emacs/site-lisp/elpa/popon-0.13/popon-autoloads hides /usr/share/emacs/site-lisp/elpa-src/popon-0.13/popon-autoloads
/usr/share/emacs/site-lisp/elpa/popon-0.13/popon-pkg hides /usr/share/emacs/site-lisp/elpa-src/popon-0.13/popon-pkg
/usr/share/emacs/site-lisp/elpa/posframe-1.1.7/posframe-pkg hides /usr/share/emacs/site-lisp/elpa-src/posframe-1.1.7/posframe-pkg
/usr/share/emacs/site-lisp/elpa/posframe-1.1.7/posframe-autoloads hides /usr/share/emacs/site-lisp/elpa-src/posframe-1.1.7/posframe-autoloads
/usr/share/emacs/site-lisp/elpa/posframe-1.1.7/posframe hides /usr/share/emacs/site-lisp/elpa-src/posframe-1.1.7/posframe
/usr/share/emacs/site-lisp/elpa/projectile-2.8.0/projectile-pkg hides /usr/share/emacs/site-lisp/elpa-src/projectile-2.8.0/projectile-pkg
/usr/share/emacs/site-lisp/elpa/projectile-2.8.0/projectile-autoloads hides /usr/share/emacs/site-lisp/elpa-src/projectile-2.8.0/projectile-autoloads
/usr/share/emacs/site-lisp/elpa/projectile-2.8.0/projectile hides /usr/share/emacs/site-lisp/elpa-src/projectile-2.8.0/projectile
/usr/share/emacs/site-lisp/elpa/py-isort-2016.1/py-isort hides /usr/share/emacs/site-lisp/elpa-src/py-isort-2016.1/py-isort
/usr/share/emacs/site-lisp/elpa/py-isort-2016.1/py-isort-autoloads hides /usr/share/emacs/site-lisp/elpa-src/py-isort-2016.1/py-isort-autoloads
/usr/share/emacs/site-lisp/elpa/py-isort-2016.1/py-isort-pkg hides /usr/share/emacs/site-lisp/elpa-src/py-isort-2016.1/py-isort-pkg
/usr/share/emacs/site-lisp/elpa/pyvenv-1.21/pyvenv hides /usr/share/emacs/site-lisp/elpa-src/pyvenv-1.21/pyvenv
/usr/share/emacs/site-lisp/elpa/pyvenv-1.21/pyvenv-pkg hides /usr/share/emacs/site-lisp/elpa-src/pyvenv-1.21/pyvenv-pkg
/usr/share/emacs/site-lisp/elpa/pyvenv-1.21/pyvenv-autoloads hides /usr/share/emacs/site-lisp/elpa-src/pyvenv-1.21/pyvenv-autoloads
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-common hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-common
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-mode-tests hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-mode-tests
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-mode-treesitter hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-mode-treesitter
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-cargo hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-cargo
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-mode-autoloads
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-utils hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-utils
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-rustfmt hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-rustfmt
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-mode hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-mode
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-playpen hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-playpen
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-prog-mode hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-prog-mode
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-mode-pkg
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-cargo-tests hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-cargo-tests
/usr/share/emacs/site-lisp/elpa/rust-mode-1.0.6/rust-compile hides /usr/share/emacs/site-lisp/elpa-src/rust-mode-1.0.6/rust-compile
/usr/share/emacs/site-lisp/elpa/s-1.12.0/s-autoloads hides /usr/share/emacs/site-lisp/elpa-src/s-1.12.0/s-autoloads
/usr/share/emacs/site-lisp/elpa/s-1.12.0/s-pkg hides /usr/share/emacs/site-lisp/elpa-src/s-1.12.0/s-pkg
/usr/share/emacs/site-lisp/elpa/s-1.12.0/s hides /usr/share/emacs/site-lisp/elpa-src/s-1.12.0/s
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-map hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-map
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-indent hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-indent
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-syntax hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-syntax
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-lib hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-lib
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-pkg
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-prettify-symbols hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-prettify-symbols
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-compile hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-compile
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-organise hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-organise
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-autoloads
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-paragraph hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-paragraph
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-imenu hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-imenu
/usr/share/emacs/site-lisp/elpa/scala-mode-1.1.0/scala-mode-fontlock hides /usr/share/emacs/site-lisp/elpa-src/scala-mode-1.1.0/scala-mode-fontlock
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq-24 hides /usr/share/emacs/site-lisp/elpa-src/seq-2.24/seq-24
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq-autoloads hides /usr/share/emacs/site-lisp/elpa-src/seq-2.24/seq-autoloads
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq hides /usr/share/emacs/site-lisp/elpa-src/seq-2.24/seq
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq-pkg hides /usr/share/emacs/site-lisp/elpa-src/seq-2.24/seq-pkg
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq-25 hides /usr/share/emacs/site-lisp/elpa-src/seq-2.24/seq-25
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-project-follow-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-project-follow-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-dom hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-dom
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-follow-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-follow-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-logging hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-logging
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-autoloads hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-autoloads
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-compatibility hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-compatibility
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-async hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-async
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-themes hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-themes
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-mouse-interface hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-mouse-interface
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-tag-follow-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-tag-follow-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-bookmarks hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-bookmarks
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-fringe-indicator hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-fringe-indicator
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-filewatch-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-filewatch-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-interface hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-interface
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-tags hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-tags
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-visuals hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-visuals
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-core-utils hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-core-utils
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-peek-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-peek-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-annotations hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-annotations
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-icons hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-icons
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-persistence hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-persistence
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-diagnostics hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-diagnostics
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-scope hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-scope
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-extensions hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-extensions
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-rendering hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-rendering
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-customization hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-customization
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-file-management hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-file-management
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-faces hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-faces
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-macros hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-macros
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-git-commit-diff-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-git-commit-diff-mode
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-treelib hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-treelib
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-hydras hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-hydras
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-pkg hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-pkg
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-header-line hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-header-line
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-icons-dired hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-icons-dired
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-workspaces hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-workspaces
/usr/share/emacs/site-lisp/elpa/treemacs-3.1/treemacs-mode hides /usr/share/emacs/site-lisp/elpa-src/treemacs-3.1/treemacs-mode
/usr/share/emacs/site-lisp/elpa/treemacs-magit-3.1/treemacs-magit hides /usr/share/emacs/site-lisp/elpa-src/treemacs-magit-3.1/treemacs-magit
/usr/share/emacs/site-lisp/elpa/treemacs-magit-3.1/treemacs-magit-pkg hides /usr/share/emacs/site-lisp/elpa-src/treemacs-magit-3.1/treemacs-magit-pkg
/usr/share/emacs/site-lisp/elpa/treemacs-magit-3.1/treemacs-magit-autoloads hides /usr/share/emacs/site-lisp/elpa-src/treemacs-magit-3.1/treemacs-magit-autoloads
/usr/share/emacs/site-lisp/elpa/treemacs-projectile-3.1/treemacs-projectile-pkg hides /usr/share/emacs/site-lisp/elpa-src/treemacs-projectile-3.1/treemacs-projectile-pkg
/usr/share/emacs/site-lisp/elpa/treemacs-projectile-3.1/treemacs-projectile-autoloads hides /usr/share/emacs/site-lisp/elpa-src/treemacs-projectile-3.1/treemacs-projectile-autoloads
/usr/share/emacs/site-lisp/elpa/treemacs-projectile-3.1/treemacs-projectile hides /usr/share/emacs/site-lisp/elpa-src/treemacs-projectile-3.1/treemacs-projectile
/usr/share/emacs/site-lisp/elpa/vterm-0.0.2/vterm-load-path hides /usr/share/emacs/site-lisp/elpa-src/vterm-0.0.2/vterm-load-path
/usr/share/emacs/site-lisp/elpa/vterm-0.0.2/vterm hides /usr/share/emacs/site-lisp/elpa-src/vterm-0.0.2/vterm
/usr/share/emacs/site-lisp/elpa/vterm-0.0.2/vterm-pkg hides /usr/share/emacs/site-lisp/elpa-src/vterm-0.0.2/vterm-pkg
/usr/share/emacs/site-lisp/elpa/vterm-0.0.2/vterm-autoloads hides /usr/share/emacs/site-lisp/elpa-src/vterm-0.0.2/vterm-autoloads
/usr/share/emacs/site-lisp/elpa/web-mode-17.3.13/web-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/web-mode-17.3.13/web-mode-pkg
/usr/share/emacs/site-lisp/elpa/web-mode-17.3.13/web-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/web-mode-17.3.13/web-mode-autoloads
/usr/share/emacs/site-lisp/elpa/web-mode-17.3.13/web-mode hides /usr/share/emacs/site-lisp/elpa-src/web-mode-17.3.13/web-mode
/usr/share/emacs/site-lisp/elpa/with-editor-3.3.2/with-editor-pkg hides /usr/share/emacs/site-lisp/elpa-src/with-editor-3.3.2/with-editor-pkg
/usr/share/emacs/site-lisp/elpa/with-editor-3.3.2/with-editor-autoloads hides /usr/share/emacs/site-lisp/elpa-src/with-editor-3.3.2/with-editor-autoloads
/usr/share/emacs/site-lisp/elpa/with-editor-3.3.2/with-editor hides /usr/share/emacs/site-lisp/elpa-src/with-editor-3.3.2/with-editor
/usr/share/emacs/site-lisp/elpa/xml-rpc-1.6.17/xml-rpc hides /usr/share/emacs/site-lisp/elpa-src/xml-rpc-1.6.17/xml-rpc
/usr/share/emacs/site-lisp/elpa/xml-rpc-1.6.17/xml-rpc-pkg hides /usr/share/emacs/site-lisp/elpa-src/xml-rpc-1.6.17/xml-rpc-pkg
/usr/share/emacs/site-lisp/elpa/xml-rpc-1.6.17/xml-rpc-autoloads hides /usr/share/emacs/site-lisp/elpa-src/xml-rpc-1.6.17/xml-rpc-autoloads
/usr/share/emacs/site-lisp/elpa/yaml-mode-0.0.16/yaml-mode-pkg hides /usr/share/emacs/site-lisp/elpa-src/yaml-mode-0.0.16/yaml-mode-pkg
/usr/share/emacs/site-lisp/elpa/yaml-mode-0.0.16/yaml-mode hides /usr/share/emacs/site-lisp/elpa-src/yaml-mode-0.0.16/yaml-mode
/usr/share/emacs/site-lisp/elpa/yaml-mode-0.0.16/yaml-mode-autoloads hides /usr/share/emacs/site-lisp/elpa-src/yaml-mode-0.0.16/yaml-mode-autoloads
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.1/yasnippet-autoloads hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.1/yasnippet-autoloads
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.1/yasnippet-pkg hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.1/yasnippet-pkg
/usr/share/emacs/site-lisp/elpa/yasnippet-0.14.1/yasnippet hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-0.14.1/yasnippet
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets-pkg hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets-pkg
/usr/share/emacs/site-lisp/elpa/yasnippet-snippets-20220713/yasnippet-snippets-autoloads hides /usr/share/emacs/site-lisp/elpa-src/yasnippet-snippets-20220713/yasnippet-snippets-autoloads
/usr/share/emacs/site-lisp/elpa/zenburn-theme-2.8.0/zenburn-theme hides /usr/share/emacs/site-lisp/elpa-src/zenburn-theme-2.8.0/zenburn-theme
/usr/share/emacs/site-lisp/elpa/zenburn-theme-2.8.0/zenburn-theme-pkg hides /usr/share/emacs/site-lisp/elpa-src/zenburn-theme-2.8.0/zenburn-theme-pkg
/usr/share/emacs/site-lisp/elpa/zenburn-theme-2.8.0/zenburn-theme-autoloads hides /usr/share/emacs/site-lisp/elpa-src/zenburn-theme-2.8.0/zenburn-theme-autoloads
/usr/share/emacs/site-lisp/elpa/seq-2.24/seq hides /usr/share/emacs/29.4/lisp/emacs-lisp/seq

Features:
(shadow emacsbug url-queue magit-extras magit-bookmark magit-submodule
magit-obsolete magit-blame magit-stash magit-reflog magit-bisect
magit-push magit-pull magit-fetch magit-clone magit-remote magit-commit
magit-sequence magit-notes magit-worktree magit-tag magit-merge
magit-branch magit-reset magit-files magit-refs magit-status magit
magit-repos magit-apply magit-wip magit-log which-func imenu magit-diff
smerge-mode diff git-commit log-edit add-log magit-core magit-autorevert
magit-margin magit-transient magit-process with-editor shell magit-mode
transient magit-git magit-section etags fileloop generator xref
shr-color help-fns radix-tree cl-print debug backtrace magit-utils crm
dired-aux mailalias po face-remap matlab matlab-scan matlab-syntax
matlab-compat qp mm-archive sort gnus-cite mail-extr textsec uni-scripts
idna-mapping ucs-normalize uni-confusable textsec-check gnus-async
gnus-bcklg gnus-ml gnus-topic cursor-sensor utf-7 url-cache nnfolder
gnus-demon nnml ezgnus gnus-delay gnus-draft gnus-agent gnus-srvr
gnus-score score-mode nnvirtual nntp gnus-cache nndraft nnmh mu4e
mu4e-org org ob ob-tangle ob-ref ob-lob ob-table ob-exp org-macro
org-src ob-comint org-pcomplete pcomplete org-list org-footnote
org-faces org-entities noutline outline ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol org-fold org-fold-core org-keys oc org-loaddefs
find-func org-version org-compat org-macs format-spec mu4e-notification
notifications mu4e-main mu4e-view mu4e-mime-parts cal-menu calendar
cal-loaddefs mu4e-headers mu4e-thread mu4e-actions mu4e-compose
mu4e-draft gnus-msg gnus-art mm-uu mml2015 mm-view mml-smime smime dig
gnus-sum gnus-group gnus-undo gnus-start gnus-dbus dbus gnus-cloud
nnimap nnmail mail-source utf7 nnoo gnus-spec gnus-int gnus-range
gnus-win gnus nnheader range mu4e-search mu4e-lists mu4e-bookmarks
mu4e-mark mu4e-message shr pixel-fill kinsoku url-file svg xml dom
flow-fill mu4e-contacts mu4e-update mu4e-folders mu4e-context
mu4e-query-items mu4e-server mu4e-modeline mu4e-vars mu4e-helpers
mu4e-config mu4e-window ido message yank-media rfc822 mml mml-sec
gnus-util mm-decode mm-bodies mm-encode mailabbrev gmm-utils mailheader
mu4e-obsolete mule-util jka-compr windmove flyspell ispell gnutls
network-stream epa-file epa derived rcirc parse-time iso8601 time-date
term/xterm xterm comp comp-cstr server cap-words superword subword vc-hg
vc-git diff-mode vc-bzr vc-src vc-sccs vc-svn vc-cvs vc-rcs log-view
pcvs-util vc vc-dispatcher bug-reference disp-table whitespace
yasnippet-snippets yasnippet cus-edit cus-start wid-edit init
mu4e-debian-hx90 zenburn-theme xclip treesit-auto treesit
treemacs-project-follow-mode treemacs-follow-mode treemacs-rendering
treemacs-annotations treemacs-async treemacs-visuals
treemacs-fringe-indicator pulse color treemacs-workspaces treemacs-dom
treemacs-icons treemacs-themes treemacs-scope treemacs-core-utils
treemacs-logging treemacs-customization pfuture inline ht s hl-line dash
keychain-environment exec-path-from-shell corfu-terminal popon
corfu-popupinfo corfu-echo corfu compat compat-30 activities-tabs
activities persist bookmark pp edmacro kmacro auth-source-xoauth2-plugin
smtpmail sendmail mail-utils oauth2 url-http url-auth mail-parse rfc2231
rfc2047 rfc2045 mm-util ietf-drums mail-prsvr url-gw nsm puny plstore
epg rfc6068 epg-config advice icomplete cus-load flymake-proc flymake
project compile text-property-search comint ansi-osc ansi-color ring
warnings icons thingatpt cl-extra help-mode use-package
use-package-ensure use-package-delight use-package-diminish
use-package-bind-key bind-key easy-mmode use-package-core
display-line-numbers autorevert filenotify
keychain-environment-autoloads treesit-auto-autoloads xclip-autoloads rx
info debian-el dired dired-loaddefs finder-inf package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile url-vars cl-loaddefs cl-lib rmc
iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook
vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify lcms2 dynamic-setting system-font-setting
font-render-setting cairo move-toolbar gtk x-toolkit xinput2 x multi-tty
make-network-process native-compile emacs)

Memory information:
((conses 16 1284383 173587)
 (symbols 48 38751 38)
 (strings 32 161682 13995)
 (string-bytes 1 5119905)
 (vectors 16 102981)
 (vector-slots 8 2547120 157205)
 (floats 8 1011 1550)
 (intervals 56 48502 7145)
 (buffers 984 76))

-- 
Xiyue Deng

--=-=-=
Content-Type: application/emacs-lisp
Content-Disposition: attachment; filename=auth-source-xoauth2-plugin.el
Content-Transfer-Encoding: quoted-printable

;; auth-source-xoauth2-plugin.el -- authentication source plugin for xoauth=
2 -*- lexical-binding: t -*-

;; Copyright (C) 2024 Xiyue Deng <manphiz@HIDDEN>

;; Author: Xiyue Deng <manphiz@HIDDEN>
;; Version: 0.1-git
;; Package-Requires: ((emacs "28.1") (oauth2 "0.17"))

;; This file is not part of GNU Emacs.

;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; GNU Emacs is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

;;; Commentary:

;; This package enables support for xoauth2 authentication with
;; auth-source.  To set up, please put this file in the `load-path' of
;; Emacs, and add the following lines in your Emacs configuration:

;;     (require 'auth-source-xoauth2-plugin)
;;     (auth-source-xoauth2-plugin-enable)

;; or with use-package:

;;     (use-package auth-source-xoauth2-plugin
;;       :config
;;       (auth-source-xoauth2-plugin-enable))

;; After enabling, smtpmail should be supported.  To enable this in Gnus
;; nnimap, you should also set `(nnimap-authenticator xoauth2)' in the
;; corresponding account settings in `gnus-secondary-select-methods'

;; auth-source uses the `secret' field in auth-source file as password
;; for authentication, including xoauth2.  To decide which
;; authentication method to use (e.g. plain password vs xoauth2), it
;; inspects the `auth' field from the auth-source entry, and if the
;; value is `xaouth2', it will try to gather data and get the access
;; token for use of xoauth2 authentication; otherwise, it will fallback
;; to the default authentication method.

;; When xoauth2 authentication is enabled, it will try to get the
;; following data from the auth-source entry: `auth-url', `token-url',
;; `scope', `client-id', `client-secret', `redirect-uri', and optionally
;; `state'.  These information will be used by oauth2 to retrieve the
;; access-token.  This package uses an advice to switch the auth-source
;; search result from the `password' to the `access-token' it got, which
;; in turn will be used to construct the xoauth2 authentication string,
;; currently in nnimap-login and smtpmail-try-auth-method.  To really
;; enable xoauth2 in smtpmail, it will add 'xoauth2 to
;; 'smtpmail-auth-supported (if it is not already in the list) using
;; `add-to-list' so that xoauth2 is tried first.

;; Note that currently the auth-source requires the searched entry must
;; have `secret' field set in the entry, which is not necessary when
;; using xoauth2.  Therefore in the advice it temporarily disables
;; checking for `:secret' if set and perform the search, and check the
;; result before returning.

;;; Code:

(require 'auth-source)
(require 'cl-lib)
(require 'oauth2)
(require 'smtpmail)

(defun auth-source-xoauth2-plugin--search-backends (orig-fun &rest args)
  "Perform auth-source-search and set password as access-token when request=
ed.
The substitution only happens if one sets `auth' to `xoauth2' in
your auth-source-entry.  It is expected that `token_url',
`client_id', `client_secret', and `refresh_token' are properly
set along `host', `user', and `port' (note the snake_case)."
  (auth-source-do-trivia "Advising auth-source-search")
  (let (check-secret)
    (when (memq :secret (nth 5 args))
      (auth-source-do-trivia
       "Required fields include :secret.  As we are requesting access token=
 to replace the secret, we'll temporary remove :secret from the require lis=
t and check that it's properly set to a valid access token later.")
      (setf (nth 5 args) (remove :secret (nth 5 args)))
      (setq check-secret t))
    (let ((orig-res (apply orig-fun args))
          res)
      (dolist (auth-data orig-res)
        (auth-source-do-trivia "Matched auth data: %s" (pp-to-string auth-d=
ata))
        (let ((auth (plist-get auth-data :auth)))
          (when (and auth
                     (stringp auth)
                     (string=3D auth "xoauth2"))
            (auth-source-do-debug
             ":auth set to `xoauth2'.  Will get access token.")
            (let ((auth-url (plist-get auth-data :auth-url))
                  (token-url (plist-get auth-data :token-url))
                  (scope (plist-get auth-data :scope))
                  (client-id (plist-get auth-data :client-id))
                  (client-secret (plist-get auth-data :client-secret))
                  (redirect-uri (plist-get auth-data :redirect-uri))
                  (state (plist-get auth-data :state)))
              (auth-source-do-trivia "Using oauth2 to auth and store token.=
..")
              (let ((token (oauth2-auth-and-store
                            auth-url token-url scope client-id client-secret
                            redirect-uri state)))
                (auth-source-do-trivia "oauth2 token: %s" (pp-to-string tok=
en))
                (auth-source-do-trivia "Refreshing token...")
                (oauth2-refresh-access token)
                (auth-source-do-trivia "oauth2 token after refresh: %s"
                                       (pp-to-string token))
                (let ((access-token (oauth2-token-access-token token)))
                  (auth-source-do-trivia
                   "Updating :secret with access-token: %s" access-token)
                  (plist-put auth-data :secret access-token))))))

        (unless (and check-secret
                     (not (plist-get auth-data :secret)))
          (auth-source-do-trivia "Updating auth-source-search results.")
          (add-to-list 'res auth-data t)))
      res)))

;;;###autoload
(defun auth-source-xoauth2-plugin-enable ()
  "Enable auth-source-xoauth2-plugin."
  (unless (memq 'xoauth2 smtpmail-auth-supported)
    (add-to-list 'smtpmail-auth-supported 'xoauth2))

  (advice-add 'auth-source-search-backends :around
              #'auth-source-xoauth2-plugin--search-backends))

(provide 'auth-source-xoauth2-plugin)

;;; auth-source-xoauth2-plugin.el ends here

--=-=-=--




Acknowledgement sent to Xiyue Deng <manphiz@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#72992; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Sun, 12 Jan 2025 05:45:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.