【问题标题】:how to grab gmail contact list after user gets authenticated with oauth2用户通过 oauth2 进行身份验证后如何获取 gmail 联系人列表
【发布时间】:2012-02-27 17:50:12
【问题描述】:

通过 oauth2 对用户进行身份验证后,我得到了令牌。 那么该获取请求应该如何在 php 中检索用户的 gmail 联系人列表?

这是 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']);

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

谢谢

【问题讨论】:

标签: php google-contacts-api


【解决方案1】:

您正在阅读正确的文档。但请参考Client Libraries and Sample Code 部分的示例代码。

另外,请查看链接http://gdatatips.blogspot.com/2008/11/2-legged-oauth-in-php.html

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

【讨论】:

    【解决方案2】:

    你小心看错了文档。试试这个http://code.google.com/apis/contacts/docs/3.0/developers_guide.html

    这是您要查找的网址 https://www.google.com/m8/feeds/contacts/userEmail/full

    【讨论】:

      【解决方案3】:

      你可以通过这个得到一个想法:

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

      选择联系人以一一查看。只需将数据从一个 URL 传递到另一个。

      并参考此博客... http://anandafit.info/2011/03/08/google-contact-list-reader-in-php-google-oauth/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2015-07-27
        • 2020-06-24
        • 2015-11-08
        • 2011-08-01
        • 2023-03-08
        • 1970-01-01
        • 2011-11-16
        相关资源
        最近更新 更多