I
I
Igor Tkachenko2014-01-29 03:56:35
Yii
Igor Tkachenko, 2014-01-29 03:56:35

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;
        }        
  }

and after all this, how can I make it so that the user's data can be used, or written to the database.
ZY wrote everything on a self-made framework and on a fatfreeframework, so don't swear.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question