This commit is contained in:
eson 2023-08-30 10:41:49 +08:00
parent fc96d181b3
commit 1221baec10

View File

@ -54,7 +54,7 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
// userinfo 传入值时, 一定不为null
var googleOauthConfig = &oauth2.Config{
RedirectURL: fmt.Sprintf("http://%s/api/user/oauth2/login/google", l.svcCtx.Config.MainAddress),
RedirectURL: fmt.Sprintf("https://%s/api/auth/oauth2/login/google", l.svcCtx.Config.MainAddress),
ClientID: l.svcCtx.Config.OAuth.Google.Appid,
ClientSecret: l.svcCtx.Config.OAuth.Google.Secret,
Scopes: []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"},
@ -67,8 +67,7 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
resp.SetStatus(basic.CodeApiErr)
}
ses := requests.NewSession()
r, err := ses.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + token.AccessToken).Execute()
r, err := requests.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + token.AccessToken).Execute()
if err != nil {
logx.Error(err)
return resp.SetStatus(basic.CodeOAuthGoogleApiErr)