feat: generic oauth

This commit is contained in:
Stavros
2025-01-24 17:13:51 +02:00
parent f487e25ac5
commit 90f4c3c980
8 changed files with 165 additions and 33 deletions

View File

@@ -7,12 +7,12 @@ import (
"net/http"
)
type GithubEmailsResponse []struct {
Email string `json:"email"`
Primary bool `json:"primary"`
type GithubUserInfoResponse []struct {
Email string `json:"email"`
Primary bool `json:"primary"`
}
func GithubScopes() ([]string) {
func GithubScopes() []string {
return []string{"user:email"}
}
@@ -29,7 +29,7 @@ func GetGithubEmail(client *http.Client) (string, error) {
return "", bodyErr
}
var emails GithubEmailsResponse
var emails GithubUserInfoResponse
jsonErr := json.Unmarshal(body, &emails)
@@ -44,4 +44,4 @@ func GetGithubEmail(client *http.Client) (string, error) {
}
return "", errors.New("no primary email found")
}
}