用户通过oauth2进行身份验证后如何获取gmail联系人列表

问题描述:

在使用oauth2对用户进行身份验证之后,我得到了令牌. 因此,如何获取请求应该是在php中检索用户的gmail联系人列表?

After getting user authenticated with oauth2, i got the token. so how that get request should be to retrieve user's gmail contact list in php ?

这是oauth2的代码

here is the code for oauth2

session_start();

require_once 'src/apiClient.php';


$client = new apiClient();

$client->setClientId('CLIENTID');
$client->setClientSecret('CLIENTSECRET');
$client->setRedirectUri('URI');
$client->setApplicationName("NAME");
$client->setScopes("http://www.google.com/m8/feeds/");
if (isset($_SESSION['access_token'])) {
  $client->setAccessToken($_SESSION['access_token']);
} else {
  $client->setAccessToken($client->authenticate());
}
$_SESSION['access_token'] = $client->getAccessToken();

print($_SESSION['access_token']);

那我该如何获取用户的联系人列表?

then how can i get contact list of user ?

谢谢

您正在阅读正确的文档.但是请参考客户端库和示例代码部分以获取示例代码.

You were reading the right document. But refer the section Client Libraries and Sample Code for sample code.

还要检查链接 http://gdatatips .blogspot.com/2008/11/2-legged-oauth-in-php.html

我可以看到该示例使用Google联系人列表API检索.

I can see that the example uses Google contacts list API retrieval.