1
OpenID提供商的電子郵件地址。當我登錄StackOverflow上使用谷歌來,我得到以下信息:獲得使用Janrain OpenID庫
Stackoverflow.com是要求從您的谷歌帳戶例如@ gmail的一些信息。 COM
•電子郵件地址:[email protected]
然而,在我自己的網站,當我登錄使用OpenID我不能要求電子郵件地址。相反,我得到這個消息:
你與你的谷歌帳戶[email protected]
我也發現很難在我需要哪一步瞭解登錄到example.com請求電子郵件地址。這裏是我認爲代碼中的一個步驟應該建設成爲:
/**
* Authenticates the given OpenId identity.
* Defined by Zend_Auth_Adapter_Interface.
*
* @throws Zend_Auth_Adapter_Exception If answering the authentication query is impossible
* @return Zend_Auth_Result
*/
public function authenticate() {
$id = $this->_id;
$consumer = new Auth_OpenID_Consumer($this->_storage);
if (!empty($id)) {
$authRequest = $consumer->begin($id);
if (is_null($authRequest)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", 'Unknown error')
);
}
if (Auth_OpenID::isFailure($authRequest)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", "Could not redirect to server: " . $authRequest->message)
);
}
$redirectUrl = $authRequest->redirectUrl($this->_root, $this->_returnTo);
if (Auth_OpenID::isFailure($redirectUrl)) {
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
$id,
array("Authentication failed", $redirectUrl->message)
);
}
Zend_OpenId::redirect($redirectUrl);
} else {
$response = $consumer->complete(Zend_OpenId::selfUrl());
switch($response->status) {
case Auth_OpenID_CANCEL:
case Auth_OpenID_FAILURE:
return new Zend_Auth_Result(
Zend_Auth_Result::FAILURE,
null,
array("Authentication failed. " . @$response->message)
);
break;
case Auth_OpenID_SUCCESS:
return $this->_constructSuccessfulResult($response);
break;
}
}
}
這似乎是它應該是那麼明顯......但我有一個困難時期谷歌搜索,並通過代碼來梳理想辦法。任何幫助將不勝感激!