gitee测试回调重定向
This commit is contained in:
parent
aab8b65f99
commit
f694b0968d
|
|
@ -676,20 +676,26 @@ func handleGiteeCallback(c *gin.Context) {
|
||||||
decodedBytes, err := base64.StdEncoding.DecodeString(stateBase64Str)
|
decodedBytes, err := base64.StdEncoding.DecodeString(stateBase64Str)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Println("Decoding error:", err)
|
fmt.Println("Decoding error:", err)
|
||||||
|
} else {
|
||||||
|
if code == "" || stateBase64Str == "" {
|
||||||
|
log.Println("code or state is empty")
|
||||||
} else {
|
} else {
|
||||||
decodedStr := string(decodedBytes)
|
decodedStr := string(decodedBytes)
|
||||||
//json解析
|
//json解析
|
||||||
var state proto.ThirdPartyLoginState
|
var state proto.ThirdPartyLoginState
|
||||||
err = json.Unmarshal([]byte(decodedStr), &state)
|
err = json.Unmarshal([]byte(decodedStr), &state)
|
||||||
log.Println("handle github callback state:", decodedStr, "\tcode:", code)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println("json unmarshal error:", err)
|
log.Println("json unmarshal error:", err)
|
||||||
}
|
} else {
|
||||||
|
log.Println("handle github callback state:", decodedStr, "\tcode:", code)
|
||||||
service.DoGiteeCallBack(&state, code)
|
service.DoGiteeCallBack(&state, code)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
resp.Code = 0
|
resp.Code = 0
|
||||||
resp.Message = "success"
|
resp.Message = "success"
|
||||||
c.JSON(http.StatusOK, resp)
|
c.JSON(http.StatusOK, resp)
|
||||||
|
c.Redirect(http.StatusFound, "https://sv.ljsea.top/") //重定向到登录页面
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetGithubAuthUrl(c *gin.Context) {
|
func GetGithubAuthUrl(c *gin.Context) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue