Heh I just started implementing OpenID again (with ZF 1.8) and ran into a problem (again) working with Google's Provider... this is where my google search led me :P
First I'll say that Yahoo is working fine for me (using https://me.yahoo.com as the endpoint). Now for Google.... discovery still seems to be failing... and my hack above results in getting an invalid page from Google. I'll peek around to see if I can find/make a fix.
Here's my code, which is pretty similar to the example in the ZF OpenID docs (as i said before using https://me.yahoo.com as $_POST['login_openid'] works for me, but https://www.google.com/accounts/o8/id does not work [discovery fails].)
Code:
if (isset($_POST['login_openid'])) {
$consumer = new Zend_OpenId_Consumer();
if (!$consumer->login($_POST['login_openid'])) {
echo $consumer->getError() . "<hr />";
exit("failed on openid login");
}
} elseif (isset($_GET['openid_mode'])) {
if ($_GET['openid_mode'] == 'id_res') {
$consumer = new Zend_OpenId_Consumer();
if ($consumer->verify($_GET, $id)) {
/* block of pseudo code, you probably want to use $id (the user's openid identifier) to retrieve the appropriate user id from your database or something */
$query = "check your database for $id";
$data = "get the row from $query response";
if (!$data) {
exit("openid doesnt exist in db, failed openid login: $id");
}
$userid = $data['userid'];
} else {
exit("invalid id");
}
} else {
exit("failed on openid_mode");
}
}