Hello everybody,
Below is a working example of my OpenId implementation. I use hyves.nl as the OpenId provider but this also works with me.yahoo.com and probably other OpenId providers as well (but not Google).
So far so good. But now I want to fetch the nickname and/or fullname from my hyves profile. But when I set nickname and/or fullname to true in the $props array I can't login anymore at all.
What am I doing wrong here?
class TestController extends Zend_Controller_Action
{
private $_sreg = null;
public function init()
{
$props = array('nickname' => false,
'email' => false,
'fullname' => false,
'dob' => false,
'gender' => false,
'postcode' => false,
'country' => false,
'language' => false,
'timezone' => false);
$this->_sreg = new Zend_OpenId_Extension_Sreg($props);
}
public function loginAction()
{
$consumer = new Zend_OpenId_Consumer();
if (!$consumer->login('hyves.nl', 'http://localhost/trouwcom/public/test/verify', 'http://localhost/trouwcom', $this->_sreg))
{
echo 'Login failed';
}
$this->_helper->viewRenderer->setNoRender();
}
public function verifyAction()
{
$consumer = new Zend_OpenId_Consumer();
if ($consumer->verify($_GET, $id, $this->_sreg))
{
echo 'VALID ' . htmlspecialchars($id);
$data = $this->_sreg->getProperties();
print_r($data);
}
else
{
echo 'INVALID ' . htmlspecialchars($id);
}
$this->_helper->viewRenderer->setNoRender();
}
}