EOAuthUserIdentity class implements IUserIdentity Yii interface and the OAuth protocol to authenticate a user.
Based on Google's software.
protected/extensions/eoauthUse this sample actions for login/logout with Google:
public function actionLogin() { Yii::import('ext.eoauth.*'); $ui = new EOAuthUserIdentity( array( //Set the "scope" to the service you want to use 'scope'=>'https://sandbox.google.com/apis/ads/publisher/', 'provider'=>array( 'request'=>'https://www.google.com/accounts/OAuthGetRequestToken', 'authorize'=>'https://www.google.com/accounts/OAuthAuthorizeToken', 'access'=>'https://www.google.com/accounts/OAuthGetAccessToken', ) ) ); if ($ui->authenticate()) { $user=Yii::app()->user; $user->login($ui); $this->redirect($user->returnUrl); } else throw new CHttpException(401, $ui->error); } public function actionLogout() { Yii::app()->user->logout(); // Redirect to application home page. $this->redirect(Yii::app()->homeUrl); }
Some time ago I developed this extension for InDaHouseRulez SL. I no longer work there, but I still support the extension.
The extension was released under the MIT license, so I made a fork on GitHub, where you'll find the latest version:
https://github.com/jorgebg/yii-eoauth
Total 8 comments
I am getting error like :
Error 401
oauth_problem=SCOPE_INVALID%20%3A%20http%3A%2F%2Fapi.linkedin.com%2Fv1%2Fpeople%2F~%3A%28karmrajsinh
I have make following changes.
$ui = new EOAuthUserIdentity( array( //Set the "scope" to the service you want to use 'scope'=>'http://api.linkedin.com/v1/people/~:(myfirstname,mylastname)', 'provider'=>array( 'request'=>'https://api.linkedin.com/uas/oauth/requestToken', 'authorize'=>'https://api.linkedin.com/uas/oauth/authenticate', 'access'=>'https://api.linkedin.com/uas/oauth/accessToken', ) ) );@Burzum : I have install this extension its working perfectly. I can login to my application with my gmail accoount automatically. But i dont know how to connect to my application with my linkedin profile? where i need to make changes??
it's nice extension but it really lacks documentation, I even could'nt reach right information about how to use the token even from google-api-dfp-php (the api which this extension is based on). I'm not sure if this part is included in this api or not!!
How to make it work with POST requests instead of GETs?
That's work fine for the authentification, but what about calling services after? Like http://api.linkedin.com/v1/people/~
Is it possible with your extention?
You saved my life!! I'm using your classes to connect with Linkedin, that works fine!!
Huh?
Hi,CGeorge, following your guide to test this extension, there is an issue after i logining and allowing in google to use oauth
That is a standard PHP deserialization issue.
The way to avoid this issue is that, set to load the extensions in the main.php
Leave a comment
Please login to leave your comment.