Skip to content

Gmail / Office 365 support #48

@kerhac

Description

@kerhac

I would like to use git-credential-oauth to obtain access tokens for Gmail and Office 365 accounts. Any chance you can add them? Below I've added an example with client credentials borrowed from Mozilla Thunderbird.

diff --git a/main.go b/main.go
index 19bd2b7..235d9d4 100644
--- a/main.go
+++ b/main.go
@@ -104,6 +104,19 @@ var configByHost = map[string]oauth2.Config{
 		ClientSecret: "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",
 		Endpoint:     endpoints.Google,
 		Scopes:       []string{"https://www.googleapis.com/auth/gerritcodereview"}},
+	// client ID & secret borrowed from mozilla for demonstration purposes
+	"smtp.gmail.com:587": {
+		ClientID:     "406964657835-aq8lmia8j95dhl1a2bvharmfk3t1hgqj.apps.googleusercontent.com",
+		ClientSecret: "kSmqreRr0qwBWJgbf5Y-PjSU",
+		Endpoint:     endpoints.Google,
+		Scopes:       []string{"https://mail.google.com/"}},
+	// client ID & secret borrowed from mozilla for demonstration purposes
+	"smtp.office365.com:587": {
+		ClientID:     "08162f7c-0fd2-4200-a84a-f25a4db0b584",
+		ClientSecret: "TxRBilcHdC6WGBee]fs?QR:SJ8nI[g82",
+		Endpoint:     endpoints.AzureAD(""),
+		Scopes:       []string{"https://outlook.office.com/SMTP.Send"},
+		RedirectURL:  "http://localhost/"},
 }
 
 var (

To add some context, here is the git send-mail patch[1] which uses git-credential-oauth to send emails using oauth.

[1] https://lore.kernel.org/git/20240225103413.9845-1-julian@swagemakers.org/T/#u

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions