我使用的是谷歌阿比PHP客户端登录用户。我想获得用户的电子邮件地址。 我有下面的代码。
范围:
$client->setScopes('https://www.googleapis.com/auth/userinfo.profile');
码:
$request = new apiHttpRequest("https://www.googleapis.com/oauth2/v2/userinfo?alt=json");
$userinfo = $client->getIo()->authenticatedRequest($request);
$response = $userinfo->getResponseBody();
print "<pre>" . print_r(json_decode($response, true), true) . "</pre>";
这给我的只有以下细节
Array ( [id] => 110084312800396764 [name] => Harsha MV [given_name] => Harsha M [family_name] => V [picture] => https://lh6.googleusercontent.com/-Xusc8lwgLIQ/AAAAAAAAAAI/AAAAAAAAAAA/sOthy23uJGk/photo.jpg [locale] => en )