第三方登录添加gitee,修改url

This commit is contained in:
junleea 2025-04-28 13:38:42 +08:00
parent c6da195d27
commit 39adf3f1bd
2 changed files with 8 additions and 1 deletions

View File

@ -113,6 +113,12 @@ type GitHubOAuthRequest struct {
RedirectURI string `json:"redirect_uri"` RedirectURI string `json:"redirect_uri"`
} }
type GiteeOAuthRequest struct {
OAuthGetTokenRequest
//'grant_type': 'authorization_code',
GrantType string `json:"grant_type"`
}
// github返回用户信息 // github返回用户信息
type GitHubUserInfo struct { type GitHubUserInfo struct {
LoginUserName string `json:"login"` // 用户名 LoginUserName string `json:"login"` // 用户名

View File

@ -6,11 +6,12 @@ import (
) )
func GetGiteeAccessTokenByCode(code string, redirectURI string, clientID string, clientSecret string) (proto.GiteeOAuthTokenResponse, error) { func GetGiteeAccessTokenByCode(code string, redirectURI string, clientID string, clientSecret string) (proto.GiteeOAuthTokenResponse, error) {
req := proto.OAuthGetTokenRequest{ req := proto.GiteeOAuthRequest{
ClientID: clientID, ClientID: clientID,
ClientSecret: clientSecret, ClientSecret: clientSecret,
Code: code, Code: code,
RedirectURI: redirectURI, RedirectURI: redirectURI,
GrantType: "authorization_code",
} }
var resp proto.GiteeOAuthTokenResponse var resp proto.GiteeOAuthTokenResponse
reqBytes, err := json.Marshal(req) reqBytes, err := json.Marshal(req)