When I sign in to StackOverflow using Google, I get the following message:
Stackoverflow.com is asking for some information from your Google Account example@gmail.com
• Email address: example@gmail.com
However, on my own site, when I log in with OpenID I can't ask for the e-mail address. Instead, I get this message:
You are signing in to example.com with your Google Account example@gmail.com
I am also finding it difficult to understand at what step I need to request the e-mail address. Here is the code that I think the step should be built into:
/**
* 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;
}
}
}
This seems like it should be so obvious... but I'm having a hard time Googling it and combing through the code to figure it out. Any help would be greatly appreciated!