Answer the question
In order to leave comments, you need to log in
Hybridauth in Yii (data after authorization)
Made authorization through hybridauth in yii through Google.
public function actionLogin()
{
//session_start();
if (!isset($_GET['provider']))
{
$this->redirect('/codefix/site');
return;
}
try
{
Yii::import('ext.components.HybridAuthIdentity');
$haComp = new HybridAuthIdentity();
//if (!$haComp->validateProviderName($_GET['provider']))
//{
// throw new CHttpException ('500', 'Invalid Action. Please try again.');
//}
$haComp->adapter = $haComp->hybridAuth->authenticate($_GET['provider']);
$haComp->userProfile = $haComp->adapter->getUserProfile();
$login = $this->userProfile->email;
//Yii::app()->user->login($login, 0);
$haComp->processLogin(); //further action based on successful login or re-direct user to the required url
}
catch (Exception $e)
{
//die(var_dump($haComp));
//process error message as required or as mentioned in the HybridAuth 'Simple Sign-in script' documentation
$this->redirect('/codefix/site');
return;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question