用户通过oauth2进行身份验证后如何获取gmail联系人列表 [英] how to grab gmail contact list after user gets authenticated with oauth2

查看:173
本文介绍了用户通过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.

这篇关于用户通过oauth2进行身份验证后如何获取gmail联系人列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆