Zend Framework Forum

Go Back   Zend Framework Forum > Zend Framework Components > Web & Web Services

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-18-2008, 05:07 AM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default Hack for Google OpenID support ZF 1.6.2

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-16-2009, 06:57 AM
Junior Member
 
Join Date: May 2008
Posts: 8
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-06-2009, 09:21 PM
Junior Member
 
Join Date: Dec 2007
Posts: 7
Default

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");
	}
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT. The time now is 03:26 PM.


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