mirror of
https://github.com/d99kris/nmail.git
synced 2026-04-26 09:46:01 +03:00
[GH-ISSUE #190] Unable to setup gmail account using custom oauth2 #130
Labels
No labels
bug
enhancement
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nmail#130
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @krackout on GitHub (Feb 9, 2026).
Original GitHub issue: https://github.com/d99kris/nmail/issues/190
Originally assigned to: @d99kris on GitHub.
Description:
Unable to setup gmail account using oauth2.
As in the nmail readme - gmail prerequisites, I enabled IMAP, setup my own OAuth 2.0 application with Google and configured
~/.config/nmail/auth.confwith my ID and secret. I startednmail --setup gmail-oauth2but it fails (the app is not approved). I noticed that in the browser, opened as it should to enter username/password to approve the app, app name "nmail email client" is shown instead of the custom name I had given.To be certain that my OAuth 2.0 application with Google is correctly setup, I setup claws-mail using oauth2, same gmail account; it worked flawlessly. The difference I could see was that when browser opened to enter username/password to approve the app, the app name was the custom one I entered while creating my own OAuth2 app in Google (apparently read from the entered ID in oauth2 settings). Claws-mail is also not approved by google, so it was a suitable candidate to simulate the behaviour.
How to reproduce it:
nmail --setup gmail-oauth2After first run, when ~/.config/nmail dir is created, I made ~/.config/nmail/auth.conf with my ID and secret and retried
nmail --setup gmail-oauth2. Same result. It seems to me thatauth.conffile is ignored (or something is wrong on my setup), that's why nmail still uses its name, "nmail email client", apparently its ID also, instead of the one I set in auth.conf.Environment:
I also tried my ID and secret quoted, no difference.
@d99kris commented on GitHub (Feb 9, 2026):
Hi @krackout - thanks for reporting a bug, I can reproduce the issue here as well. I'll take a look at fixing it, but I'm away for two weeks so it'll take a little while. Meanwhile, feel free to request an invite if you like to use the nmail OAuth2 project, until we get custom oauth2 client working.
@krackout commented on GitHub (Feb 9, 2026):
Hi Kristofer!
The best email client, for free and open source (I have tried many, paid also). The least I can do is to wait :)
If it cannot be solved, I'll send a request, thank you.
Στις 2026-02-09 14:52 ο/η Kristofer Berggren @.***> έγραψε:
@d99kris commented on GitHub (Feb 22, 2026):
Hi again,
Thanks for the kind feedback :)
Custom oauth2 client support should be fixed in
97687c4/v5.11.1.For reference, I used the following steps to test:
Note: Using a non-default config dir (
-d ~/.nmail-custom-oauth2) is not needed.~/.nmail-custom-oauth2/auth.confand set id / secret:delete all your email from Gmail." and click continue.
Let me know if you encounter any issues!
@krackout commented on GitHub (Feb 23, 2026):
I did the steps as instructed but I still haven't connected.
nmail -d ~/.nmail-custom-oauth2 -s gmail-oauth2command:Log:
It seems that something is wrong from my side, but Claws Mail connected successfully. I changed secret, because I had already used it in Claws Mail. Still the same. I have no knowledge of oauth2, should I delete the client in Google auth platform, because it was already used when I tested Claws? I'm currently doing this, but it takes some time.
I'm not reopening the issue, I need to test further. I mentioned the results just in case you see something obvious that I miss.
@d99kris commented on GitHub (Feb 23, 2026):
Hi, just a quick reply on this:
No, it's not needed. One can use same client in Google for many apps.
If the browser reaches "Authentication successful" I suspect it's a bug in nmail. I'll see if I can try on Debian. But meanwhile can I check what python version you have?
python --version@krackout commented on GitHub (Feb 24, 2026):
Python 3.13.5, the default version supplied by Debian 13 (Trixie)
On 2026-02-24 01:41 Kristofer Berggren @.***> wrote:
@d99kris commented on GitHub (Feb 24, 2026):
Thanks 👍 I don't have 13 (Trixie) at the moment, but I tested 12 without issues using custom oauth2 just now. So at least it's not a general Linux or general Debian issue.
Maybe it's some locale incompatibility in the nmail python script. What's your output from
locale?If no other luck, I could invite you to my custom oauth2 app, and then let you capture
-ee(extra verbose logging), and share the log privately with me ond99kris at gmail dot com(I believe the log will contain secrets)..@d99kris commented on GitHub (Feb 28, 2026):
I tested now on a fresh Debian 13 (Trixie) x86_64 VM and it's working fine with custom oauth2 app with gmail.
Will however reopen this issue so I don't lose track of it, until it's resolved.
@krackout commented on GitHub (Mar 2, 2026):
You were right! It was the locale settings. Mine are
LC_ALL=el_GR.UTF-8. I temporarily switched toLC_ALL=CandLANG=Cand setup completed smoothly. Setting locale to C is a bit hard core, but I wanted to be on the safe side. Now I run nmail withLC_ALL=el_GR.UTF-8(to be able to view unicode characters as with my other instances of nmail) and it works fine. Switching locale was needed only during setup.Time to regain my gmail mailbox!