用户通过oauth2进行身份验证后如何获取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 ?

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 ?

Thank you

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

Also, check the link http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html

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

You ware looking at the wrong doco. Try this instead http://code.google.com/apis/contacts/docs/3.0/developers_guide.html

here is the url that you are looking for https://www.google.com/m8/feeds/contacts/userEmail/full

You can get an idea by using this:

https://code.google.com/oauthplayground/

choose contact to see one by one steps. Just pass data from one URL to other.

And refer this blog... http://anandafit.info/2011/03/08/google-contact-list-reader-in-php-google-oauth/