GNU bug report logs - #78240
30.1; xoauth2 authentication fails in gnus imap mail fetching

Previous Next

Package: emacs;

Reported by: Anush V <j <at> gnu.org>

Date: Sun, 4 May 2025 13:52:02 UTC

Severity: normal

Found in version 30.1

To reply to this bug, email your comments to 78240 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Sun, 04 May 2025 13:52:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Anush V <j <at> gnu.org>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 04 May 2025 13:52:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Anush V <j <at> gnu.org>
To: bug-gnu-emacs <at> gnu.org
Cc: manphiz <at> gmail.com
Subject: 30.1; xoauth2 authentication fails in gnus imap mail fetching
Date: Sun, 04 May 2025 09:51:10 -0400
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))))


corresponding logs

     Waiting for response from imap.gmail.com...done
     Mail source (imap :server imap.gmail.com :port 993 :user <my_email> :stream ssl :dontexpunge t :fetchflag \Seen :authentication xoauth2) error (IMAP error: nil)
     nnmaildir: Reading incoming mail (no new mail)...done


I suspect the imap-authenticate call in mail-source-fetch-imap is
failing because xoauth2 and its related CHECK/AUTHENTICATE functions
are missing from imap-authenticator-alist

Please let me know if i’m wrong/missing something.

Since auth-source-xoauth2-plugin is an elpa package, i mailed here and
cc’ed the package maintainer.  If this is wrong place for this, please
let me know the appropriate mailing list.

Thank you for your time

* * *

In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
cairo version 1.18.2)
System Description: Guix System

Configured using:
 'configure
 CONFIG_SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash
 SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash --prefix=/gnu/store/lq0nwm8qkj9cmyjm85z3dcqrjnglhcym-emacs-next-pgtk-30.1-rc1-2.7144e84 --enable-fast-install --with-pgtk --with-cairo --with-modules --with-native-compilation=aot --disable-build-details'

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

--
Regards,
Anush V




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Sun, 04 May 2025 23:44:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Xiyue Deng <manphiz <at> gmail.com>
To: Anush V <j <at> gnu.org>, bug-gnu-emacs <at> gnu.org
Subject: Re: 30.1; xoauth2 authentication fails in gnus imap mail fetching
Date: Sun, 04 May 2025 16:43:28 -0700
[Message part 1 (text/plain, inline)]
Hi Anush,

Anush V <j <at> gnu.org> 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?

>
> corresponding logs
>
>      Waiting for response from imap.gmail.com...done
>      Mail source (imap :server imap.gmail.com :port 993 :user <my_email> :stream ssl :dontexpunge t :fetchflag \Seen :authentication xoauth2) error (IMAP error: nil)
>      nnmaildir: Reading incoming mail (no new mail)...done
>
>
> I suspect the imap-authenticate call in mail-source-fetch-imap is
> failing because xoauth2 and its related CHECK/AUTHENTICATE functions
> are missing from imap-authenticator-alist
>
> Please let me know if i’m wrong/missing something.
>
> Since auth-source-xoauth2-plugin is an elpa package, i mailed here and
> cc’ed the package maintainer.  If this is wrong place for this, please
> let me know the appropriate mailing list.
>
> Thank you for your time
>
> * * *
>
> In GNU Emacs 30.1 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43,
> cairo version 1.18.2)
> System Description: Guix System
>
> Configured using:
>  'configure
>  CONFIG_SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash
>  SHELL=/gnu/store/m0xdsa8cfq6mq1kxgxmpmpg71la4f0b9-bash-minimal-5.1.16/bin/bash --prefix=/gnu/store/lq0nwm8qkj9cmyjm85z3dcqrjnglhcym-emacs-next-pgtk-30.1-rc1-2.7144e84 --enable-fast-install --with-pgtk --with-cairo --with-modules --with-native-compilation=aot --disable-build-details'
>
> Configured features:
> ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ
> JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 MODULES NATIVE_COMP
> NOTIFY INOTIFY PDUMPER PGTK PNG RSVG SECCOMP SOUND SQLITE3 THREADS
> TIFF TOOLKIT_SCROLL_BARS TREE_SITTER XIM GTK3 ZLIB
>
> --
> Regards,
> Anush V

[1] https://elpa.gnu.org/packages/auth-source-xoauth2-plugin.html
[2] https://gitlab.com/manphiz/auth-source-xoauth2-plugin/

-- 
Regards,
Xiyue Deng
[signature.asc (application/pgp-signature, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Mon, 05 May 2025 03:12:04 GMT) Full text and rfc822 format available.

Message #11 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Anush V <j <at> gnu.org>
To: Xiyue Deng <manphiz <at> gmail.com>
Cc: bug-gnu-emacs <at> gnu.org
Subject: Re: 30.1; xoauth2 authentication fails in gnus imap mail fetching
Date: Sun, 04 May 2025 23:10:09 -0400
> From: Xiyue Deng <manphiz <at> gmail.com>
> Date: Sun,  4 May 2025 16:43:28 -0700
>
> Hi Anush,
>
> Anush V <j <at> gnu.org> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Mon, 05 May 2025 14:26:01 GMT) Full text and rfc822 format available.

Message #14 received at 78240 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Anush V <j <at> gnu.org>
Cc: 78240 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#78240: 30.1; xoauth2 authentication fails in gnus imap mail
 fetching
Date: Mon, 05 May 2025 16:25:05 +0200
>>>>> On Sun, 04 May 2025 23:10:09 -0400, Anush V <j <at> gnu.org> said:

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

It will if you configure `nnimap-split-methods' to copy from the
nnimap backend to a local one. Or just copy the emails manually.

(I took a look at imap.el. It currently has zero integration with
auth-source, so getting nnimap to work should be a lot easier).

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Wed, 07 May 2025 01:56:02 GMT) Full text and rfc822 format available.

Message #17 received at 78240 <at> debbugs.gnu.org (full text, mbox):

From: Anush V <j <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 78240 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#78240: 30.1; xoauth2 authentication fails in gnus imap mail
 fetching
Date: Tue, 06 May 2025 21:54:13 -0400
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Mon,  5 May 2025 16:25:05 +0200
>
>>>>>> On Sun, 04 May 2025 23:10:09 -0400, Anush V <j <at> gnu.org> said:
>
>     Anush> I tested nnimap and it works as expected. However, unlike
>     Anush> mail-sources, nnimap doesn't download emails to my machine.
>
> It will if you configure `nnimap-split-methods' to copy from the
> nnimap backend to a local one. Or just copy the emails manually.

I couldn’t figure out from info manual how to copy mails to local
using nnimap-split-methods.  I tried (nnimap-split-methods
'("nnmaildir+mail:inbox2" "")), but it ended up splitting mails on the
server.

I’m able to copy the emails manually though.

--
Regards,
Anush




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Wed, 07 May 2025 07:20:02 GMT) Full text and rfc822 format available.

Message #20 received at 78240 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Anush V <j <at> gnu.org>
Cc: 78240 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#78240: 30.1; xoauth2 authentication fails in gnus imap mail
 fetching
Date: Wed, 07 May 2025 09:19:04 +0200
>>>>> On Tue, 06 May 2025 21:54:13 -0400, Anush V <j <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Date: Mon,  5 May 2025 16:25:05 +0200
    >> 
    >>>>>>> On Sun, 04 May 2025 23:10:09 -0400, Anush V <j <at> gnu.org> said:
    >> 
    Anush> I tested nnimap and it works as expected. However, unlike
    Anush> mail-sources, nnimap doesn't download emails to my machine.
    >> 
    >> It will if you configure `nnimap-split-methods' to copy from the
    >> nnimap backend to a local one. Or just copy the emails manually.

    Anush> I couldn’t figure out from info manual how to copy mails to local
    Anush> using nnimap-split-methods.  I tried (nnimap-split-methods
    Anush> '("nnmaildir+mail:inbox2" "")), but it ended up splitting mails on the
    Anush> server.

I think that should be

(nnimap-split-methods '(("nnmaildir+mail:inbox2" "")))

(but I donʼt do nnimap splitting)

Robert
-- 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Sat, 10 May 2025 22:28:02 GMT) Full text and rfc822 format available.

Message #23 received at 78240 <at> debbugs.gnu.org (full text, mbox):

From: Anush V <j <at> gnu.org>
To: Robert Pluim <rpluim <at> gmail.com>
Cc: 78240 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#78240: 30.1; xoauth2 authentication fails in gnus imap mail
 fetching
Date: Sat, 10 May 2025 18:27:05 -0400
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Wed,  7 May 2025 09:19:04 +0200
>
>>>>>> On Tue, 06 May 2025 21:54:13 -0400, Anush V <j <at> gnu.org> said:
>
>     >> From: Robert Pluim <rpluim <at> gmail.com>
>     >> Date: Mon,  5 May 2025 16:25:05 +0200
>     >>
>     >>>>>>> On Sun, 04 May 2025 23:10:09 -0400, Anush V <j <at> gnu.org> said:
>     >>
>     Anush> I tested nnimap and it works as expected. However, unlike
>     Anush> mail-sources, nnimap doesn't download emails to my machine.
>     >>
>     >> It will if you configure `nnimap-split-methods' to copy from the
>     >> nnimap backend to a local one. Or just copy the emails manually.
>
>     Anush> I couldn’t figure out from info manual how to copy mails to local
>     Anush> using nnimap-split-methods.  I tried (nnimap-split-methods
>     Anush> '("nnmaildir+mail:inbox2" "")), but it ended up splitting mails on the
>     Anush> server.
>
> I think that should be
>
> (nnimap-split-methods '(("nnmaildir+mail:inbox2" "")))

This also didn’t copy mails to local.

--
Regards,
Anush




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#78240; Package emacs. (Tue, 13 May 2025 16:34:01 GMT) Full text and rfc822 format available.

Message #26 received at 78240 <at> debbugs.gnu.org (full text, mbox):

From: Robert Pluim <rpluim <at> gmail.com>
To: Anush V <j <at> gnu.org>
Cc: 78240 <at> debbugs.gnu.org, Xiyue Deng <manphiz <at> gmail.com>
Subject: Re: bug#78240: 30.1; xoauth2 authentication fails in gnus imap mail
 fetching
Date: Tue, 13 May 2025 18:33:39 +0200
>>>>> On Sat, 10 May 2025 18:27:05 -0400, Anush V <j <at> gnu.org> said:

    >> From: Robert Pluim <rpluim <at> gmail.com>
    >> Date: Wed,  7 May 2025 09:19:04 +0200
    >> 
    >>>>>>> On Tue, 06 May 2025 21:54:13 -0400, Anush V <j <at> gnu.org> said:
    >> 
    >> >> From: Robert Pluim <rpluim <at> gmail.com>
    >> >> Date: Mon,  5 May 2025 16:25:05 +0200
    >> >>
    >> >>>>>>> On Sun, 04 May 2025 23:10:09 -0400, Anush V <j <at> gnu.org> said:
    >> >>
    Anush> I tested nnimap and it works as expected. However, unlike
    Anush> mail-sources, nnimap doesn't download emails to my machine.
    >> >>
    >> >> It will if you configure `nnimap-split-methods' to copy from the
    >> >> nnimap backend to a local one. Or just copy the emails manually.
    >> 
    Anush> I couldn’t figure out from info manual how to copy mails to local
    Anush> using nnimap-split-methods.  I tried (nnimap-split-methods
    Anush> '("nnmaildir+mail:inbox2" "")), but it ended up splitting mails on the
    Anush> server.
    >> 
    >> I think that should be
    >> 
    >> (nnimap-split-methods '(("nnmaildir+mail:inbox2" "")))

    Anush> This also didn’t copy mails to local.

Hmm, I get splitting when I also set `nnimap-inbox' appropriately, but
itʼs all server side splitting, and it uses `nnmail-split-methods'
instead of the nnimap variable, so either Iʼve got a config issue or
itʼs a a bug. Iʼll keep looking over the next week.

Robert
-- 




This bug report was last modified 1 day ago.

Previous Next


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