git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] send-email: implement SMTP bearer authentication

From
M Hickford <mirth.hickford@gmail.com>
Date
Jan 7, 2025, 19:49 UTC
Message-ID
<20250107194953.2104-1-mirth.hickford@gmail.com>
Hi Julian. The patch looks good. Please could you add instructions how to test it? Which servers have you tested?
I have a gmail.com account. I configured Git following https://git-scm.com/docs/git-send-email#_use_gmail_as_the_smtp_server
	[sendemail]
		smtpEncryption = tls
		smtpServer = smtp.gmail.com
		smtpUser = yourname@gmail.com
		smtpServerPort = 587
And configured git-credential-oauth following https://github.com/hickford/git-credential-oauth/issues/48#issuecomment-1966486513
	[credential "smtp://smtp.gmail.com:587"]
		oauthClientId = 406964657835-aq8lmia8j95dhl1a2bvharmfk3t1hgqj.apps.googleusercontent.com
		oauthClientSecret = kSmqreRr0qwBWJgbf5Y-PjSU
		oauthScopes = https://mail.google.com/
		oauthAuthURL = https://accounts.google.com/o/oauth2/auth
		oauthTokenURL = https://oauth2.googleapis.com/token
Then tested with: git send-email --smtp-auth=XOAUTH2 --smtp-debug=1 message.txt
"git credential" was queried for an OAuth access token as expected. Note that Gmail access tokens are very long (~220 characters).
However smtp.gmail.com responded authentication error "535-5.7.8 Username and Password not accepted".
Looking at the debug information, it looks like the SMTP command "AUTH XOAUTH2 <base64>" was corrupted by a space at column 241. Exactly one base64 string should follow "AUTH XOAUTH2 ", no spaces.
The same problem occurs with OAUTHBEARER: git send-email --smtp-auth=OAUTHBEARER --smtp-debug=1 message.txt
I can reproduce this with any sufficiently long combination of user and pass, such as: git send-email --smtp-auth=XOAUTH2 --smtp-user=tim.arsietonarsei@example.com --smtp-pass=arsteiarositanrestnerastarstarstarstarstarsetnrasetnearstrasitenarseitnerasntearnstenarsetnearstarstearsetnariestnearsntenarestnerast --smtp-encryption=tls --smtp-server-port=587 --smtp-server=smtp.gmail.com --smtp-debug=1 message.txt
Can you reproduce this problem?
Any ideas?
I think the bug must be in the call to Net::SMTP.
Next: Julian Swagemakers
Message 1 of 3 in “Re: [PATCH] send-email: implement SMTP bearer authentication”
  1. M HickfordJan 7, 2025
  2. Julian SwagemakersJan 11, 2025
  3. M HickfordJan 11, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.