![]() |
|
|||
|
EDIT: this doesn't work anymore....
I found that version 1.6.2 of the ZF wasn't working with Google's OpenID provider. A few lines added to the consumer class seems to work if you're willing to hack it, until ZF supports it (maybe 1.7 does, I'm not sure). File info: * @version $Id: Consumer.php 11817 2008-10-10 04:24:20Z yoshida@zend.co.jp $ Find "protected function _discovery" (line 688). There's a big block of "if/else if" under /* HTML-based discovery */ Just tack the following onto it: (should be lines 732 - 738) else if(preg_match('/<URI>([^<]+)<\/URI>/i', $response, $r)) { $version = 2.0; $server = $r[1]; } NOTE: I HAVE NOT TESTED THIS BEYOND USING IT ONCE TO SUCCESSFULLY LOGIN. USE AT YOUR OWN RISK
Last edited by bholub; 05-07-2009 at 04:43 AM. |
|
|||
|
I tried this but it doesn't seem to be working instead I get redirected to a page on google which is not the authentication page
How do I get this to work. From what I noticed I can't use my google or Yahoo to sign in using the zend_openid
|
|
|||
|
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");
}
}
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
| Designed by: Miner Skinz |
Powered by vBulletin® Version 3.8.4 Copyright ©2000 - 2010, Jelsoft Enterprises Ltd. Search Engine Friendly URLs by vBSEO 3.1.0 |
![]() |