diff --git a/proto/tool.go b/proto/tool.go index 4292273..16b9578 100644 --- a/proto/tool.go +++ b/proto/tool.go @@ -113,6 +113,12 @@ type GitHubOAuthRequest struct { RedirectURI string `json:"redirect_uri"` } +type GiteeOAuthRequest struct { + OAuthGetTokenRequest + //'grant_type': 'authorization_code', + GrantType string `json:"grant_type"` +} + // github返回用户信息 type GitHubUserInfo struct { LoginUserName string `json:"login"` // 用户名 diff --git a/worker/gitee.go b/worker/gitee.go index b0447e4..b4f81c8 100644 --- a/worker/gitee.go +++ b/worker/gitee.go @@ -6,11 +6,12 @@ import ( ) func GetGiteeAccessTokenByCode(code string, redirectURI string, clientID string, clientSecret string) (proto.GiteeOAuthTokenResponse, error) { - req := proto.OAuthGetTokenRequest{ + req := proto.GiteeOAuthRequest{ ClientID: clientID, ClientSecret: clientSecret, Code: code, RedirectURI: redirectURI, + GrantType: "authorization_code", } var resp proto.GiteeOAuthTokenResponse reqBytes, err := json.Marshal(req)