Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Janrain's PHP-OpenID and Google/Yahoo

I'm using Janrain's PHP-OpenID 2.1.3, and I've managed to get it working with all the providers I have tried except for Google and Yahoo. The major difference here seems to be that Google and Yahoo, unlike most other providers, don't use a user-specific URL, but rather have the user discovery framework all on their end - which throws the default Janrain framework for a loop then it tries to begin the auth request.

From what I've seen it looks like it's probably the YADIS discovery that is throwing the error, which should be able to be bypassed since the discovery is on Google or Yahoo's end, but I'm not sure. This is all a big informal learning experience for me, and I haven't had any luck finding documentation that can help me on this one. Any tips would be greatly appreciated.

Edit: the specific problem I am having is that when the begin() function is called for the Google or Yahoo URL, I get a null return. This function is found in Auth/OpenID/Consumer.php for reference.

like image 543
Dan G. Avatar asked Jun 14 '09 11:06

Dan G.


2 Answers

Ok, I finally got to fix the library... I explained everything here (you can also download the php-openid library after my changes).

I needed to do what Paul Tarjan suggested but, also, I needed to modify the Auth_OpenID_detectMathLibrary and add the static keyword to a lot of functions. After that It seems to work perfectly although it is not an ideal solution... I think that someone should rewrite the whole library in PHP 5...

like image 147
miguelSantirso Avatar answered Oct 27 '22 04:10

miguelSantirso


I had the same problem on Windows XP. Fixed by activating curl extension. To do this uncomment in php.ini the line

extension=php_curl.dll

by removing the ; in front of it if any. Restart apache.

Also on windows to work properly you need to define Auth_OpenID_RAND_SOURCE as null since in windows you don't have a random source. You can do this by adding the line

define('Auth_OpenID_RAND_SOURCE', null);

in CryptUtil.php before the first code line

if(!defined('Auth_OpenID_RAND_SOURCE')){

Even if the curl is not enabled the API should work by using instead the Auth_Yadis_PlainHTTPFetcher to communicat via HTTP. In the case of Google and Yahoo you need https, so it only works if open_ssl is enabled (Auth_Yadis_PlainHTTPFetcher::supportsSSL must return true).

like image 45
Andrei Bica Avatar answered Oct 27 '22 04:10

Andrei Bica