Yii Framework Forum: EOAUTH how to use AccessToken - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

EOAUTH how to use AccessToken problem in using eoauth extension Rate Topic: -----

#1 User is offline   Dark-Sun 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 7
  • Joined: 04-April 12
  • Location:Ahwaz

Posted 20 July 2012 - 02:39 AM

I've installed EOAUTH extension, i can authenticate with google, but I'm wondering how to get user information after that.
here's what I do in login method of user controller:
Yii::import('ext.eoauth.*');
		
		$ui = new EOAuthUserIdentity(
				array(
				//Set the "scope" to the service you want to use
						'scope'=>'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile',
						'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(array('loggedin'));
		}
		else 
			throw new CHttpException(401, $ui->error);
		


any help would be appreciated.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users