我已经通过Google API(使用Google php api客户端)添加了网站登录,我不确定如何获得用户配置文件。
进行身份验证的代码为:
$client = new Google_Client();
$client->setClientId(ClientIDGoesHere);
$client->setClientSecret(ClientSecretGoesHere);
$client->setScopes(Google_Service_Gmail::GMAIL_READONLY);
$redirectUrl = 'http://AReference.ngrok.io/performGoogleLogin.php';
$client->setRedirectUri($redirectUrl);
$oauth = $client->getOAuth2Service();
我从这个网站尝试了以下内容,但它说找不到用户信息:
$userProfile = $oauth->userinfo->get();
我收到以下错误:注意:未定义的属性:Google\Auth\OAuth2::$userinfo在googleLogin中.php第23行
我追求given_name,family_name,电子邮件,性别,图片(很高兴有)
慕盖茨4494581