all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Xiyue Deng <manphiz@gmail.com>
To: Soham Gumaste <sohamg2@gmail.com>,
	Michael Albinus <michael.albinus@gmx.de>
Cc: emacs-devel <emacs-devel@gnu.org>
Subject: Re: Potential bug/inconsistency in auth-source netrc vs plstore backends
Date: Fri, 08 Nov 2024 14:11:43 -0800	[thread overview]
Message-ID: <87fro1s7ds.fsf@debian-hx90.lan> (raw)
In-Reply-To: <CAAr-Hh237RF2Ch8TAKARdNBTonKurpEwtsVHi5O5LxQZCtNi2w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2759 bytes --]

Soham Gumaste <sohamg2@gmail.com> writes:

>> > Hello,
>>
>> Hi Soham,
>
> Hello, thanks for your time.
>
>> What about using a fixed port like ':port "token"'? A similar (mis-)use
>> of :port is used by Tramp, where the port keeps the connection method,
>> like ':port "ssh"'.
>>
> Well, I am trying to satisfy the auth-sources-search query in the
> function nnimap-credentials in nnimap.el. That query requests the
> :port in the spec, and for the query to succeed with the plstore
> backend I need to exactly match the :port attribute in the plist saved
> by oauth2.el. This would mean I would have to store every port the
> user wants to use oauth creds with. Regardless, I still want to know
> if the discrepancy between the netrc and plstore backend is
> intentional or if I can patch it.
>

I think that's how auth-source is supposed to work.  People would need 2
entries with different `:port's, one for imap(s), one for smtp, for both to
work.  Or maybe there is a better way now?

>> This is documented in the auth manual, at the bottom of (info "(auth)
>> Help for users") . A simiar solution for oauth2.el could be documented
>> there as well.
>>
> My current workaround is to advise the nnimap-credentials with :around
> mode and returning the oauth2 token when appropriate. I'd like to make
> this more first class though. It could be done by simply tweaking the
> plist file stored by oauth2.el but the aforementioned discrepancy is
> the roadblock right now. I dare not try to edit anything in Gnus
> itself.

I think smtpmail uses the `:smtp-auth' attribute to specify which
mechanism to use[1].  In my plugin[2] I'm using `:auth' in a similar
fashion.  This has the advantage that one can have both the password and
XOAuth2 credentials in auth-source and can choose which to use simply by
changing `:auth', though this also requires coordination from nnimap[3].

Ideally I think it would be helpful if one can directly request which
mechanism to use in auth-source.  For now this has to be done
explicitly, e.g. in nnimap using `(nnimap-authenticator xoauth2)'.  If
that's not set, there can be a default sequence of authentication
mechanisms to try, like what nnimap is doing now, but put xoauth2 in
higher priority.

>> > Thanks
>>
>> Best regards, Michael.
>
> Thanks
>
> -- 
> Soham Gumaste
> sohamg2@gmail.com
>

[1] https://www.gnu.org/software/emacs/manual/html_node/smtpmail/Authentication.html
[2] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/auth-source-xoauth2-plugin.el?ref_type=heads#L106-107
[3] https://gitlab.com/xiyueden/auth-source-xoauth2-plugin/-/blob/main/auth-source-xoauth2-plugin.el?ref_type=heads#L48

-- 
Regards,
Xiyue Deng

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 857 bytes --]

  reply	other threads:[~2024-11-08 22:11 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-07 20:34 Potential bug/inconsistency in auth-source netrc vs plstore backends Soham Gumaste
2024-11-07 20:43 ` Soham Gumaste
2024-11-07 21:34 ` Xiyue Deng
2024-11-08  2:28   ` Soham Gumaste
2024-11-08  8:40 ` Michael Albinus
2024-11-08 18:00   ` Soham Gumaste
2024-11-08 22:11     ` Xiyue Deng [this message]
2024-11-10 18:29       ` Soham Gumaste
2024-11-10 23:58         ` Xiyue Deng
2024-11-15 16:54           ` Soham Gumaste

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

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

  git send-email \
    --in-reply-to=87fro1s7ds.fsf@debian-hx90.lan \
    --to=manphiz@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=michael.albinus@gmx.de \
    --cc=sohamg2@gmail.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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.