Get Userinfo from Google OAuth 2.0 PHP API

前端 未结 3 2000
天涯浪人
天涯浪人 2020-12-09 08:56

I am trying to use Google Oauth API to get userinfo. It works perfectly for Google Plus API but I am trying to create a backup in case the user doesn\'t have google plus acc

3条回答
  •  情书的邮戳
    2020-12-09 09:43

    I'm not sure if it helps, but since the Google API PHP Client was updated, I get userinfo in this way:

            $oauth = new Google_Service_Oauth2($googleClient);
    
            var_dump($oauth->userinfo->get());
    

提交回复
热议问题