zola2 / lightopenid

Automatically exported from code.google.com/p/lightopenid
0 stars 0 forks source link

Support for Google Hybrid Protocol (OpenID+OAuth) #35

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

It seems that this class doesn't support Google Hybrid Protocol with is 
basically an OAuth extension to the OpenID protocol: 
http://code.google.com/apis/accounts/docs/OpenID.html#oauth

Here is what I did to support it

* I added a public $oauth variable (false)
* Added this code to authUrl_v2:

if ( $this->oauth ) {
    $params['openid.ns.oauth'] = 'http://specs.openid.net/extensions/oauth/1.0';
    $params['openid.oauth.consumer'] = str_replace(array('http://','https://'),'',$this->trustRoot);
    $params['openid.oauth.scope'] = implode(' ',$this->oauth);
}

It's a bit hackish, but it's working for my needs. Usage example (to get the 
OAuth working you have to register your domain in Google first):

$openid->identity = "https://www.google.com/accounts/o8/id";
// request access to Google Analytics
$openid->oauth = array(
    'https://www.google.com/analytics/feeds/'
);

Hope this help!

Regards

Original issue reported on code.google.com by remi.lan...@gmail.com on 12 Apr 2011 at 11:16

GoogleCodeExporter commented 8 years ago
Hi, thanks for this code, I have been looking for a way to do just this with 
this library.

Just one question, what is the code to get Oauth Request Token and then trade 
it for the Access token?
Does it come in the $openid->getAttributes() variable?

Thanks

Original comment by marc...@santiago.cl on 1 Aug 2011 at 2:43

GoogleCodeExporter commented 8 years ago
Support for Google hybrid protocol has been added in the Github clone of 
LightOpenID at: https://github.com/iignatov/LightOpenID.

A new method was added for getting the OAuth request token - 
getOAuthRequestToken().

Hope this helps.

Original comment by ignat.ig...@gmail.com on 2 Dec 2012 at 7:33

GoogleCodeExporter commented 8 years ago
Is there an example anywhere of using LightOpenID with the hybrid OpenID and 
OAuth?  It doesn't look like the iignatov code actual supports the hybrid 
functionality.

Original comment by jeff.kis...@gmail.com on 3 Dec 2013 at 10:06