Hi Anush, Anush V writes: >> From: Xiyue Deng >> Date: Sat, 10 May 2025 20:36:25 -0700 >> >> Hi Anush, >> >> Anush V writes: >> >>> Hello Emacs maintainers, >>> >>> I have two google mail accounts, the first one uses app passwords to >>> authenticate, and the other uses oauth (because it doesn't support app >>> passwords) >>> >>> When I enable auth-source-xoauth2-plugin-mode, I’m able to send email >>> from second account without any issues. But i’m unable to send emails >>> from the first account. When I disable auth-source-xoauth2-plugin i’m >>> able to send email from the first account. >>> >>> I think that enabling xoauth2 shouldn't interfere with other >>> authentication methods, so this could be a bug. >>> >>> 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' >>> >>> -- >>> Regards, >>> Anush >>> >>> >> >> Thanks for your report! Ideally auth-source-xoauth2-plugin should only >> be in effect when your auth-source entry has "auth" set to "xoauth2". >> Can you check whether you happen to set that for your auth-source entry >> for the account using app password? Sharing your auth-source entries >> with your personal information removed would be helpful. >> >> It would also help to share some of the error logs following instruction >> in the "Debugging" section in README.org[1]. Please be careful not to >> share any personal information from the logs. >> >> [1] >> https://gitlab.com/manphiz/auth-source-xoauth2-plugin/-/blob/main/README.org?ref_type=heads > > > I did some debugging. According to comment “;; A string result is an > error.” in the function smtpmail-try-auth-methods, the function call > (smtpmail-try-auth-method process 'xoauth2 "user" "password") should > return a string when authentication fails. However, it currently > returns a list instead, which prevents other authentication methods > from being tried. > > [...] Thanks for the investigation! If the try-method don't fallback to the other supported auth methods then it will break. I tried to read the code of `smtpmail-try-auth-method' for xoauth2[1], and besides lacking encoding user and password into utf-8, I don't see anything obviously different from plain[2] and not sure why it would return a list. Would be great if any Emacs developer can shed some light here. [1] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/mail/smtpmail.el#n643 [2] https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/mail/smtpmail.el#n628 -- Regards, Xiyue Deng