我正在使用LightOpenID,我試圖獲得此gmail身份驗證的屬性,但它似乎沒有返回任何關於我的個人帳戶並且我沒有任何錯誤。我對OpenID非常陌生,希望有人能幫助我解決之前的問題。從GMail獲取屬性 - OpenID身份驗證
我在validate()
指定領域,並與process()
返回他們我正在使用的OpenID URL:https://www.google.com/accounts/o8/id
public function show() {
if ($this->site->tru->post->isRequest() || !$this->site->tru->get->isEmpty('openid_mode')) {
require_once $this->site->tru->config->get('root.path').'/lib/php/openid.php';
$this->lightOpenId = new LightOpenID;
if ($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');
}
public function process() {
if ($this->lightOpenId->validate()) {
echo '<pre>'.print_r($this->lightOpenId).'
'.print_r($this->lightOpenId->getAttributes()).'</pre>';
}
}
public function validate() {
if (!$this->site->tru->post->isEmpty('openid_url')) {
$this->lightOpenId->identity = $this->site->tru->post->get('openid_url');
$this->lightOpenId->optional = array('contact/email', 'namePerson', 'contact/postalCode/home', 'contact/country/home');
header('Location: '.$this->lightOpenId->authUrl());
}
return count($this->error) == 0;
}
啊......我明白了。謝謝! – Webnet 2010-11-17 14:02:13
其實,'contact/country/home'不工作... – Webnet 2010-11-28 01:38:02
@Webnet:的確,它似乎不起作用。我的信息基於[Google聯合登錄](http://code.google.com/apis/accounts/docs/OpenID.html)頁面,因此我認爲這些信息是正確的。 – Mewp 2010-11-28 11:21:24