- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我目前正在使用 LightOpenID 允许用户登录我的站点,我可以在其中自动提取他们的用户名和电子邮件地址:
$openid->required = array('namePerson/first', 'namePerson/last', 'contact/email');
$openid->identity = 'https://www.google.com/accounts/o8/id';
我在这里使用参数 namePerson/first
、namePerson/last
和 contact/email
。
我知道为了获得用户联系人列表,我必须使用提要:
https://www.google.com/m8/feeds
但是,我似乎无法弄清楚为此需要使用哪些参数?
如果我完全删除参数行,我只会得到一个空数组。
谁能帮我弄清楚获取联系人需要哪些参数?
这是我目前的代码:
<?php
require '/var/www/libraries/openid.php';
try {
$openid = new LightOpenID;
if(!$openid->mode) {
//$openid->required = array('gd/fullName');
$openid->identity = 'https://www.google.com/m8/feeds/contacts/oshirowanen.y%40gmail.com/full';
header('Location: ' . $openid->authUrl());
exit;
} elseif($openid->mode == 'cancel') {
echo "cancelled";
exit;
} else {
if ( $openid->validate() ) {
$returned = $openid->getAttributes();
print_r($returned);
exit;
} else {
echo "something is wrong";
exit;
}
}
} catch(ErrorException $e) {
echo $e->getMessage();
}
?>
最佳答案
你不能用 LightOpenID 做到这一点,因为它只实现了 OpenID 协议(protocol)。
您将需要 OAuth (2.0) 协议(protocol)来执行此操作。每the docs :
About authorization protocols
We recommend using OAuth 2.0 to authorize requests.
If your application has certain unusual authorization requirements, such as logging in at the same time as requesting data access (hybrid) or domain-wide delegation of authority (2LO), then you cannot currently use OAuth 2.0 tokens. In such cases, you must instead use OAuth 1.0 tokens and an API key. You can find your application's API key in the Google API Console, in the Simple API Access section of the API Access pane.
关于php - 使用 LightOpenID 获取 Google 通讯录?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11176915/
使用提供的示例代码,我可以使用我的 Google 帐户通过 lightopenid 登录到我的应用程序。我已将身份存储在 cookie 中,以便我的登录信息可以在整个 session 中保持不变。 当
我在使用名为 LightOpenID 的小型 OpenID 库时遇到问题.我可以向几乎所有提供者进行身份验证,但我不知道如何从提供者那里获取数据。即使使用 print_r(),我也只得到 Array(
你好 我几个小时前下载了 LightOpenID (http://gitorious.org/lightopenid),但仍然不知道如何让它工作。 我在 test.php 文件中保存了这个 googl
我想为我的 Web 应用程序实现一个 OpenID 登录系统。我为此使用 LightOpenID。我去了谷歌,发现旧的(在线有据可查的)OpenID2 系统 became old : Importan
使用 LightOpenID 库,我成功地在我的网站上实现了 OpenID。然而,几天前,当使用谷歌作为提供者时它就停止工作了(它在使用雅虎时运行良好!)。自从我实现 OpenID 的那一天起,它使用
我目前正在尝试为大学的小型网站实现 openID。我对此很陌生,并已跟进相关文章。我已经下载了 lightopenId 并将文件夹上传到我的网络服务器。我的学校有谷歌托管他们的电子邮件服务,所以典型的
我目前正在使用 LightOpenID 允许用户登录我的站点,我可以在其中自动提取他们的用户名和电子邮件地址: $openid->required = array('namePerson/first'
Oauth 2.0 似乎是最受支持的外部身份验证工具。然而,在网上搜索了很多很多小时后,我发现在使用 PHP 时没有简单的方法可以开始使用它。或许(但愿如此)我只是没有以正确的方式进行搜索。 这是我要
有没有办法使用 POST 方法使用 LightOpenID 库进行身份验证?确切地说,在验证之后,谷歌(例如)返回指定的 URL,但所有数据都是使用 GET 方法发送给我的,最终以丑陋和长的 URL
我正在使用 LightOpenID 针对 Google Apps 验证 OpenID。我发出初始 authURL() 请求,一切都很好。我调用 validate() 但失败了。通过大量的 echo ,
Janrain's PHP OpenID的PHP实现有什么区别?图书馆和 LightOpenID . 一个比另一个更安全吗? 根据 Google's best practices page : A c
我正在免费网络主机(awspace)上使用 LightOpenID 库,到目前为止,我所有使用开放 ID 通过 Google 帐户登录的尝试都会导致以下错误: 示例-google.php: Faile
最近,我注意到当将生成的身份存储在我的数据库中时,Google 有时会为同一用户返回不同的身份,从而导致单个用户有两个数据库条目。 经过一些研究,我发现 Google 使用 $openid->real
我是一名优秀的程序员,十分优秀!