imap-send: add support for OAuth2.0 authentication
OAuth2.0 is a new way of authentication supported by various email providers these days. OAUTHBEARER and XOAUTH2 are the two most common mechanisms used for OAuth2.0. OAUTHBEARER is described in RFC5801[1] and RFC7628[2], whereas XOAUTH2 is Google's proprietary mechanism (See [3]). [1]: https://datatracker.ietf.org/doc/html/rfc5801 [2]: https://datatracker.ietf.org/doc/html/rfc7628 [3]: https://developers.google.com/workspace/gmail/imap/xoauth2-protocol#initial_client_response Signed-off-by: Aditya Garg <gargaditya08@live.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
b9e766604d
commit
103d7b12b7
@@ -102,12 +102,18 @@ Using Gmail's IMAP interface:
|
||||
|
||||
---------
|
||||
[imap]
|
||||
folder = "[Gmail]/Drafts"
|
||||
host = imaps://imap.gmail.com
|
||||
user = user@gmail.com
|
||||
port = 993
|
||||
folder = "[Gmail]/Drafts"
|
||||
host = imaps://imap.gmail.com
|
||||
user = user@gmail.com
|
||||
port = 993
|
||||
---------
|
||||
|
||||
Gmail does not allow using your regular password for `git imap-send`.
|
||||
If you have multi-factor authentication set up on your Gmail account, you
|
||||
can generate an app-specific password for use with `git imap-send`.
|
||||
Visit https://security.google.com/settings/security/apppasswords to create
|
||||
it. Alternatively, use OAuth2.0 authentication as described below.
|
||||
|
||||
[NOTE]
|
||||
You might need to instead use: `folder = "[Google Mail]/Drafts"` if you get an error
|
||||
that the "Folder doesn't exist".
|
||||
@@ -116,6 +122,35 @@ that the "Folder doesn't exist".
|
||||
If your Gmail account is set to another language than English, the name of the "Drafts"
|
||||
folder will be localized.
|
||||
|
||||
If you want to use OAuth2.0 based authentication, you can specify
|
||||
`OAUTHBEARER` or `XOAUTH2` mechanism in your config. It is more secure
|
||||
than using app-specific passwords, and also does not enforce the need of
|
||||
having multi-factor authentication. You will have to use an OAuth2.0
|
||||
access token in place of your password when using this authentication.
|
||||
|
||||
---------
|
||||
[imap]
|
||||
folder = "[Gmail]/Drafts"
|
||||
host = imaps://imap.gmail.com
|
||||
user = user@gmail.com
|
||||
port = 993
|
||||
authmethod = OAUTHBEARER
|
||||
---------
|
||||
|
||||
Using Outlook's IMAP interface:
|
||||
|
||||
Unlike Gmail, Outlook only supports OAuth2.0 based authentication. Also, it
|
||||
supports only `XOAUTH2` as the mechanism.
|
||||
|
||||
---------
|
||||
[imap]
|
||||
folder = "Drafts"
|
||||
host = imaps://outlook.office365.com
|
||||
user = user@outlook.com
|
||||
port = 993
|
||||
authmethod = XOAUTH2
|
||||
---------
|
||||
|
||||
Once the commits are ready to be sent, run the following command:
|
||||
|
||||
$ git format-patch --cover-letter -M --stdout origin/master | git imap-send
|
||||
@@ -124,6 +159,10 @@ Just make sure to disable line wrapping in the email client (Gmail's web
|
||||
interface will wrap lines no matter what, so you need to use a real
|
||||
IMAP client).
|
||||
|
||||
In case you are using OAuth2.0 authentication, it is easier to use credential
|
||||
helpers to generate tokens. Credential helpers suggested in
|
||||
linkgit:git-send-email[1] can be used for `git imap-send` as well.
|
||||
|
||||
CAUTION
|
||||
-------
|
||||
It is still your responsibility to make sure that the email message
|
||||
|
||||
Reference in New Issue
Block a user