Subject: Re: 30.1; xoauth2 authentication fails in gnus imap mail fetching

From: Anush V <[email-masked]>
Date: Sun, 04 May 2025 23:10:09 -0400

> From: Xiyue Deng <[email-masked]>
> Date: Sun,  4 May 2025 16:43:28 -0700
>
> Hi Anush,
>
> Anush V <[email-masked]> writes:
>
>> Hello Emacs Maintainers,
>>
>> I’m using gnus and I’m unable to downloads emails using xoauth2
>> authentication (provided by auth-source-xoauth2-plugin).  I’m able to
>> send emails though.
>>
>> Configuration:
>> ;; emacs --no-init
>>      (setopt imap-log t)
>>      (require 'mail-source)
>>      (add-to-list 'mail-sources '(imap :server "imap.gmail.com"
>>                                        :port 993
>>                                        :user "<my_email>"
>>                                        :stream ssl
>>                                        ;; dont delete from server
>>                                        :dontexpunge t
>>                                        ;; mark as seen after fetching
>>                                        :fetchflag "\\Seen"
>>                                        :authentication xoauth2
>>                                        ))
>>      (setq gnus-select-method '(nnnil ""))
>>      (setq gnus-secondary-select-methods
>>            '((nnmaildir "mail"
>>                         (directory "~/tmp")
>>                         (get-new-mail t))))
>>
>
> I have only tested using Gnus with nnimap (see documentation at [1] or
> [2]) where you want to add `(nnimap-authenticator xoauth2)' to your
> `nnimap' settings.  I haven't tested with `mail-sources', which seems to
> work differently compared to nnimap, and hence the implementation may be
> missing.  I probably need to understand how `mail-sources' works and
> extend the plugin accordingly, which could take a while.
>
> Meanwhile, do you want to try using `nnimap' and see whether that works?
>

Thank you for considering extending the functionality to mail-sources.

I tested nnimap and it works as expected. However, unlike
mail-sources, nnimap doesn't download emails to my machine.

--
Regards,
Anush Veeranala