From 39adf3f1bd5c9002d481afe9e9ab02f5352bd02b Mon Sep 17 00:00:00 2001 From: junleea <354425203@qq.com> Date: Mon, 28 Apr 2025 13:38:42 +0800 Subject: [PATCH] =?UTF-8?q?=E7=AC=AC=E4=B8=89=E6=96=B9=E7=99=BB=E5=BD=95?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0gitee,=E4=BF=AE=E6=94=B9url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/tool.go | 6 ++++++ worker/gitee.go | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) 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)