This commit is contained in:
eson 2023-08-30 10:45:48 +08:00
parent 5e6b5cbbbd
commit 3ab7ed28d4

View File

@ -64,13 +64,13 @@ func (l *UserGoogleLoginLogic) UserGoogleLogin(req *types.RequestGoogleLogin, us
token, err := googleOauthConfig.Exchange(l.ctx, req.Code)
if err != nil {
logx.Error(err)
resp.SetStatus(basic.CodeApiErr)
return resp.SetStatus(basic.CodeApiErr, err.Error())
}
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)
return resp.SetStatus(basic.CodeOAuthGoogleApiErr, err.Error())
}
log.Println(r.Json())