diff --git a/service/toolService.go b/service/toolService.go index a26131e..9658565 100644 --- a/service/toolService.go +++ b/service/toolService.go @@ -207,7 +207,7 @@ func SetDashboardInfoToRedis() { func DoGithubCallBack(state *proto.ThirdPartyLoginState, code string) { //获取Access Token - resp, err := worker.ExchangeCodeForAccessToken(proto.Config.GITHUB_CLIENT_ID, proto.Config.GITHUB_CLIENT_SECRET, code, "") + resp, err := worker.ExchangeCodeForAccessTokenGithub(proto.Config.GITHUB_CLIENT_ID, proto.Config.GITHUB_CLIENT_SECRET, code, "") if err != nil { log.Println("get github access token error:", err) return @@ -218,7 +218,7 @@ func DoGithubCallBack(state *proto.ThirdPartyLoginState, code string) { } log.Println("get github access token:", resp.AccessToken) //获取用户信息 - userInfo, err := worker.GetGitHubUserInfo(resp.AccessToken) + userInfo, err := worker.GetGitHubUserInfoV2(resp.AccessToken) if err != nil { log.Println("get github user info error:", err) return diff --git a/worker/thirdParty.go b/worker/thirdParty.go index 78f2f2e..ce45714 100644 --- a/worker/thirdParty.go +++ b/worker/thirdParty.go @@ -6,6 +6,7 @@ import ( "encoding/json" "errors" "io" + "log" "net/http" ) @@ -135,11 +136,13 @@ func ExchangeCodeForAccessTokenGithub(clientID, clientSecret, code, redirectURI "token": superTokens[0], "super_id": "1", } + log.Println("ExchangeCodeForAccessTokenGithub onlineReqBytes:", string(onlineReqBytes)) err, respBytes := DoPostRequestJSON("https://vis.ljsea.top/tool/online_server_request?super_id=1", onlineReqBytes, headers) if err != nil { return githubOAuthResponse, err } + log.Println("ExchangeCodeForAccessTokenGithub respBytes:", string(respBytes)) var onlineResp proto.OutlineServerReqResp err = json.Unmarshal(respBytes, &onlineResp) if err != nil { @@ -191,8 +194,9 @@ func GetGitHubUserInfoV2(accessToken string) (proto.GitHubUserInfo, error) { "token": superTokens[0], "super_id": "1", } - + log.Println("GetGitHubUserInfoV2 onlineReqBytes:", string(onlineReqBytes)) err, respBytes := DoPostRequestJSON("https://vis.ljsea.top/tool/online_server_request?super_id=1", onlineReqBytes, headers) + log.Println("GetGitHubUserInfoV2 respBytes:", string(respBytes)) var onlineResp proto.OutlineServerReqResp var resp proto.GitHubUserInfo err = json.Unmarshal(respBytes, &onlineResp)