Zend Framework and Google OpenID Login

September 20, 2009

I wanted to use google’s federated login in my application and unfortunately found out that Zend Framework doesn’t support XRDS discovery. Fortunately (and as a testament to the size of the Zend Framework community) I wasn’t the first to hit this block and a patch was posted in the issue tracker. Not wanting to taint the library I added to my own library by extending the original and put in the patch to get this bad boy working. I also took it one step further and implemented part of the attribute exchange extension (the part that relates to specifically to the google spec. ). I’d like to get this fully done with unit tests, decoupled from google’s implementation and contributed back officially but until such time my updates can be downloaded here. Usage is the similar to that found in the original documentation except you’ll be instantiating Ak33m_OpenId_Consumer instead of Zend_OpenId_Consumer and using Ak33m_OpenId_Extension_Ax instead of Zend_OpenId_Extension_Sreg.

6 Responses

  1. Wow, thanks for this – i’ll give it a test now.

  2. … It took me all of 5 minutes to get this working – this is a great extension, thanks and keep up the good work!

    Jon.

  3. Devon Weller

    October 27th, 2009

    If you would like to use Zend_Auth_Adapter_OpenId with this solution, then use this:

    http://pastie.org/672818

    Paste this file as Ak33m/Auth/Adapter/OpenId.php, and use Ak33m_Auth_Adapter_OpenId instead of Zend_Auth_Adapter_OpenId.

  4. Devon Weller

    November 21st, 2009

    As of a couple days ago, Google changed their OpenID implementation so that it no longer works with this class. I discovered the fix involves adding 4 lines of code. My updated version of Consumer.php can be found here:

    http://pastie.org/709058

    Akeem – I hope you can update your class for others to use. It has been very helpful for me.

  5. Using this class I’ve started to receive intermittent “Authentication failedSignature check failed” when authenticating with Yahoo! OpenID. Can’t seem to figure out why…

    I can’t wait until Zend get around to officially supporting the latest standard of OpenID.

  6. This really hasn’t been fixed yet even in Zend 1.10. I’m a little disappointed that someone nominated a simple OpenID AX library for inclusion in 1.8.4 and afaik no one has made a move on it yet.

    Thanks for the AX implementation. Just a little note about Google OpenID support, though. If you want to use google apps instead of a google account there is a slightly different endpoint. To get around this I recommend change these lines:

    if ($server == ‘https://www.google.com/accounts/o8/ud’)

    to:

    if ( stripos($server,’google.com’) !== false )

    then it will work for both.

Leave a Reply