从GMail获取属性-OpenID身份验证

从GMail获取属性-OpenID身份验证,openid,openid-provider,Openid,Openid Provider,我正在使用LightOpenID,我正在尝试获取gmail身份验证的属性,但它似乎没有在我的个人帐户上返回任何内容,并且我没有收到任何错误。我是OpenID的新手,希望有人能帮我解决以前做过这件事的人 我在validate()上指定字段,并使用process() 我正在使用OpenID URL: 公共功能显示(){ 如果($this->site->tru->post->isRequest()| |!$this->site->tru->get->isEmpty('openid|u模式')){ 需要

我正在使用LightOpenID,我正在尝试获取gmail身份验证的属性,但它似乎没有在我的个人帐户上返回任何内容,并且我没有收到任何错误。我是OpenID的新手,希望有人能帮我解决以前做过这件事的人

我在
validate()
上指定字段,并使用
process()

我正在使用OpenID URL:

公共功能显示(){
如果($this->site->tru->post->isRequest()| |!$this->site->tru->get->isEmpty('openid|u模式')){
需要_once$this->site->tru->config->get('root.path')。/lib/php/openid.php';
$this->lightOpenId=新的lightOpenId;
如果($this->validate()| |$this->lightOpenId->validate()){
$this->process();
}
}
$this->site->addCss('account/login.css');
$this->site->addJs('account/login.js');
echo$this->site->tru->display->getTemplate('/site/account/login.tpl');
}
公共职能流程(){
如果($this->lightOpenId->validate()){
回显“”。打印($this->lightOpenId)。'
contact/country/home
contact/email
namePerson/first
namePerson/last
pref/language
“.print_r($this->lightOpenId->getAttributes())”; } } 公共函数验证(){ 如果(!$this->site->tru->post->isEmpty('openid\u url')){ $this->lightOpenId->identity=$this->site->tru->post->get('openid_url'); $this->lightOpenId->optional=array('contact/email','namePerson','contact/postalCode/home','contact/country/home'); 标题('Location:'。$this->lightOpenId->authUrl()); } 返回计数($this->error)==0; }
谷歌只回答所需参数,完全忽略可选参数

此外,它只能返回以下属性:

$openid->identity = 'https://www.google.com/accounts/o8/';

// use the following line to obtain the required details. These are the only details that google mail provides. This is for lightopenid.
$openid->required = array('namePerson/friendly', 'contact/email' , 'contact/country/home', 'namePerson/first', 'pref/language', 'namePerson/last'); 

header('Location: ' . $openid->authUrl());
因此,
namePerson
contact/postalCode/home
将不起作用

以上信息是谷歌特有的,与LightOpenID本身完全无关


至于库,我建议不要调用$lightOpenId->validate()两次。每次您调用它时,它都会向提供商发送一个请求,该请求可能会拒绝第二个请求。

@Webnet:的确,它似乎不起作用。我的信息是基于页面的,所以我假设那里的信息是正确的。
$openid->identity = 'https://www.google.com/accounts/o8/';

// use the following line to obtain the required details. These are the only details that google mail provides. This is for lightopenid.
$openid->required = array('namePerson/friendly', 'contact/email' , 'contact/country/home', 'namePerson/first', 'pref/language', 'namePerson/last'); 

header('Location: ' . $openid->authUrl());