how to grab gmail contact list after user gets authenticated with oauth2

你说的曾经没有我的故事 提交于 2019-12-08 05:48:56

问题


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


回答1:


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.




回答2:


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




回答3:


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/



来源:https://stackoverflow.com/questions/9469685/how-to-grab-gmail-contact-list-after-user-gets-authenticated-with-oauth2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!