public inbox for tools@linux.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Tomas Melin <tomas.melin@vaisala.com>
Cc: Konstantin Ryabitsev <konstantin@linuxfoundation.org>,  tools@kernel.org
Subject: Re: [PATCH] b4: allow using xoauth2/bearer token to authenticate to SMTP servers
Date: Tue, 10 Mar 2026 00:10:40 -0700	[thread overview]
Message-ID: <aa_DpKoL7co7FALp@google.com> (raw)
In-Reply-To: <dd4ed10a-2648-4ac5-9df7-6c453114a820@vaisala.com>

Hi Tomas,

On Tue, Mar 10, 2026 at 08:48:55AM +0200, Tomas Melin wrote:
> Hi,
> 
> On 09/03/2026 19:13, Dmitry Torokhov wrote:
> > On Mon, Mar 09, 2026 at 11:50:40AM +0200, Tomas Melin wrote:
> > > Hi,
> > > 
> > > On 09/03/2026 09:49, Dmitry Torokhov wrote:
> > > > 
> > > In your case, how do you provide the new token to git credential?
> > git credential itself calls into configured helpers and the helper does
> > this. You do not need to replicate this logic in other places.
> > 
> > > How does you .gitconfig for this look like?
> > global  sendemail.smtpserver smtp.gmail.com
> > global  sendemail.smtpserverport 587
> > global  sendemail.smtpencryption tls
> > global  sendemail.smtpuser dmitry.torokhov@gmail.com
> > global  sendemail.thread true
> > global  sendemail.bcc dmitry.torokhov@gmail.com
> > global  sendemail.suppresscc self
> > global  credential.helper cache --timeout=3000
> > global  credential.helper local-helper
> > local   sendemail.smtpuser dmitry.torokhov@gmail.com
> > local   sendemail.smtpauth XOAUTH2
> > local   sendemail.bcc dmitry.torokhov@gmail.com
> > 
> > The local-helper is a custom python script that behaves similarly to the
> > gmail credential helper, but the difference that it supports different
> > credential stores - either based on secret storage API or GPG-based so I
> > can move my configuration between a headless workstation, a VM, or my
> > laptop easily.
> > 
> > The beauty of credential helpers is that if they do not know how to
> > handle the request they simply skip it so that the next one might be
> > able to resolve it.
> 
> Yes, indeed then this looks like a cleaner solution to the authentication
> process and
> 
> the approach proposed in your patch should be taken instead of my initial
> attempt.
> 
> FWIW I tested this out, but for some reason I was occasionally not getting
> the
> 
> token back, instead it falls back to password authentication prompt (which
> then fails).


Hmm, this is weird. I've had the setup with the "git credential", my
credential helper, and "git send-email" for the last few years and I did
not observe this issue... Maybe one of the helpers is flaky? You can
call "git credential" from a script like this to test:


#!/bin/bash
#
git credential fill << ENDOFDATA | sed -n 's/^password=\(.*\)/\1/ p'
protocol=smtp
host=gmail.com
username=${1}
ENDOFDATA

to see how reliable it is. Obviously adjust host and other details as
needed.

Thanks.

-- 
Dmitry


  reply	other threads:[~2026-03-10  7:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06 16:20 [PATCH] b4: allow using xoauth2/bearer token to authenticate to SMTP servers Dmitry Torokhov
2026-03-06 17:18 ` Konstantin Ryabitsev
2026-03-06 17:35   ` Dmitry Torokhov
2026-03-09  7:28     ` Tomas Melin
2026-03-09  7:49       ` Dmitry Torokhov
2026-03-09  9:50         ` Tomas Melin
2026-03-09 17:13           ` Dmitry Torokhov
2026-03-10  6:48             ` Tomas Melin
2026-03-10  7:10               ` Dmitry Torokhov [this message]
2026-03-11 15:41               ` Konstantin Ryabitsev
2026-03-13  2:05 ` Konstantin Ryabitsev

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=aa_DpKoL7co7FALp@google.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=konstantin@linuxfoundation.org \
    --cc=tomas.melin@vaisala.com \
    --cc=tools@kernel.org \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox