unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Xiyue Deng <manphiz@gmail.com>
To: "Björn Bidar" <bjorn.bidar@thaodan.de>, "Andrew Cohen" <acohen@ust.hk>
Cc: Ted Zlatanov <tzz@lifelogs.com>,
	72992@debbugs.gnu.org, Philip Kaludercic <philipk@posteo.net>,
	Stefan Kangas <stefankangas@gmail.com>
Subject: bug#72992: 29.4; towards xoauth2 support in Emacs
Date: Sun, 22 Sep 2024 14:44:33 -0700	[thread overview]
Message-ID: <87jzf34b3y.fsf@debian-hx90.lan> (raw)
In-Reply-To: <66f00712.170a0220.29d948.0047SMTPIN_ADDED_BROKEN@mx.google.com>

Hi Björn,

Björn Bidar <bjorn.bidar@thaodan.de> writes:

> Andrew Cohen <acohen@ust.hk> writes:
>
>>>>>>> "XD" == Xiyue Deng <manphiz@gmail.com> writes:
>>
>>     XD> Hi Andrew, Andrew Cohen <acohen@ust.hk> writes:
>>
>>     >>>>>>> "XD" == Xiyue Deng <dengxiyue@gmail.com> 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?

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.

-- 
Xiyue Deng





      parent reply	other threads:[~2024-09-22 21:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-02  8:34 bug#72992: 29.4; towards xoauth2 support in Emacs Xiyue Deng
     [not found] ` <handler.72992.B.172532159013230.ack@debbugs.gnu.org>
2024-09-11  0:27   ` Xiyue Deng
2024-09-17 17:33     ` Xiyue Deng
2024-09-17 19:12 ` Philip Kaludercic
2024-09-18  6:24   ` Xiyue Deng
2024-09-18 14:11     ` Philip Kaludercic
2024-09-22  7:06       ` Xiyue Deng
2024-09-22  9:34         ` Philip Kaludercic
2024-09-22 22:00           ` Xiyue Deng
2024-09-23  6:17             ` Philip Kaludercic
2024-09-23  6:39               ` Xiyue Deng
2024-09-17 21:33 ` Stefan Kangas
2024-09-18 19:43   ` Xiyue Deng
2024-09-19  5:13     ` Andrew Cohen
2024-09-19  8:22       ` Xiyue Deng
2024-09-19  9:06         ` Andrew Cohen
2024-09-19 22:37           ` Xiyue Deng
2024-09-22 12:05             ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]             ` <66f00802.050a0220.988f0.9640SMTPIN_ADDED_BROKEN@mx.google.com>
2024-09-22 21:40               ` Xiyue Deng
2024-09-22 23:50                 ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]                 ` <66f0ad4f.500a0220.10c3c2.dde8SMTPIN_ADDED_BROKEN@mx.google.com>
2024-09-23  2:20                   ` Xiyue Deng
2024-10-03 22:41             ` Xiyue Deng
2024-10-08 13:38               ` Ted Zlatanov
2024-11-09 20:01                 ` Xiyue Deng
2024-09-22 12:01           ` Björn Bidar via Bug reports for GNU Emacs, the Swiss army knife of text editors
     [not found]           ` <66f00712.170a0220.29d948.0047SMTPIN_ADDED_BROKEN@mx.google.com>
2024-09-22 21:44             ` Xiyue Deng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87jzf34b3y.fsf@debian-hx90.lan \
    --to=manphiz@gmail.com \
    --cc=72992@debbugs.gnu.org \
    --cc=acohen@ust.hk \
    --cc=bjorn.bidar@thaodan.de \
    --cc=philipk@posteo.net \
    --cc=stefankangas@gmail.com \
    --cc=tzz@lifelogs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).