mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-12-15 12:46:37 +00:00
feat: generic oauth
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user