更新
This commit is contained in:
parent
fc96d181b3
commit
1221baec10
|
@ -54,7 +54,7 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
|
||||||
// userinfo 传入值时, 一定不为null
|
// userinfo 传入值时, 一定不为null
|
||||||
|
|
||||||
var googleOauthConfig = &oauth2.Config{
|
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,
|
ClientID: l.svcCtx.Config.OAuth.Google.Appid,
|
||||||
ClientSecret: l.svcCtx.Config.OAuth.Google.Secret,
|
ClientSecret: l.svcCtx.Config.OAuth.Google.Secret,
|
||||||
Scopes: []string{"https://www.googleapis.com/auth/userinfo.email", "https://www.googleapis.com/auth/userinfo.profile"},
|
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)
|
resp.SetStatus(basic.CodeApiErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
ses := requests.NewSession()
|
r, err := requests.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + token.AccessToken).Execute()
|
||||||
r, err := ses.Get("https://www.googleapis.com/oauth2/v2/userinfo?access_token=" + token.AccessToken).Execute()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logx.Error(err)
|
logx.Error(err)
|
||||||
return resp.SetStatus(basic.CodeOAuthGoogleApiErr)
|
return resp.SetStatus(basic.CodeOAuthGoogleApiErr)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user