Re: [PATCH v5 3/3] send-email: add option to generate passswords like OAuth2 tokens

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On 24-04-2025 08:50 pm, Junio C Hamano wrote:
> Aditya Garg <gargaditya08@xxxxxxxx> writes:
> 
>>> Something like:
>>>
>>>     [credential "smtp://smtp.office365.com:587"]
>>>         username = someone@xxxxxxxxxxx
>>>         helper = "!f() { test \"$1\" = get && echo \"password=$(cd /workspaces/codespaces-blank/M365-IMAP && python3 ./refresh_token.py)\"; }; f"
>>
>> Interesting, and this works too!. I wasn't aware of this.
>>
>> Junio, I can drop the third patch if you want.
> 
> What I want does not matter in this case, no? ;-)
> 
> It does look like an additional mechanism only for this use case is
> unneeded, but it would be nice to address a related but different
> problem, which is
> 
>     What made you write the extra mechanism in the first place?
> 
> In other words, was the current documentation insufficient for you
> to realize that credential helper is an existing good solution for
> your problem and there was no need to add a new mechanism?  If so,
> there will be numerous next "you" who will also want to use OAuth2
> token from a program output and get frustrated because they cannot
> find how to do so in our documentation, no?  Would a new paragraph
> with an example like Julian gave above be something we want to add,
> or do we already have enough information there and the only thing
> users need to do is to look a bit more carefully?

That's actually a good question. In my case, I already was frustrated
with no good option available for Outlook users to send patches reliably
to the Linux kernel. I had been banging my head and Googling a lot to
get a way. I finally reached msmtp, but then the threading broke, giving
rise to another issue. After chatting with the msmtp dev, I came to know
that its the server side issue with outlook. At this point, I was not left
with any more power to read more docs, and decided to modify the script myself.

The first hurdle was OAuth2, which I searched the mailing list with hopes, and
got the first patch, which worked beautifully. Now the only issues left were
threads and a reliable way to get OAuth2 tokens. I already had a helper script
to get the token, but I gave https://github.com/git-ecosystem/git-credential-manager
a shot. Unfortunately, it didn't work with free outlook accounts, so I was left
with my helper script. With this failure with git credential manager, I was in
an impression that its not possible to use [credential]. My bad here for not
checking the docs for this.

So I decided to take things in my own hands and patch the script. Logged a bit
and fixed the threads. Then I was inspired by the passwordeval function I used
in msmtp, and just implemented it in the third patch.



TL;DR: I should have looked at the docs of credentials as well. I kept stuck
on docs on send-mail.



My suggestion: Maybe add a small link to relevant docs in other docs as well.
Eg, in the description of SmtpPass, you can add a suggestion to use [credentials]
if you want to generate a token or something and link its doc.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux