我正在关注本教程 http://www.yiiframework.com/wiki/459/integrating-hybridauth-directly-into-yii-without-an-extension/ 进入我自己的应用程序,但我收到一个错误,我花了很多时间来找到我想念的步骤。 这是我的错误。
Alias "components.HybridAuthIdentity" is invalid. Make sure it points to an existing directory or file.
在components目录中,我创建了一个名为HybridAuthIdentity.php的文件
class HybridAuthIdentity extends CUserIdentity{`
public $hybridAuth;
public $adapter;
public $userProfile;
public $allowedProviders = array('google', 'facebook', 'linkedin', 'yahoo', 'live',);
protected $config;
function __construct()
{
$path = Yii::getPathOfAlias('ext.hybridauth');
require_once $path . '/hybridauth/Hybrid/Auth.php';
$this->config = array(
"base_url" => "touchtalent.dev/login/SocialLogin",
"providers" => array(
"LinkedIn" => array(
"enabled" => true,
"keys" => array (
"key" => "My key",
"secret" => "my secret id",
),
),
),
"debug_mode" => false,
"debug_file" => "",
);
$this->hybridAuth = new Hybrid_Auth($this->config);
}
}
在我的siteController中,我写道:
Yii::import('components.HybridAuthIdentity');
$haComp = new HybridAuthIdentity;
if(!$haComp->validateProviderName($_GET['provider']))
{
throw new CHttpException("500", "Invalid action. Please Try again");
}
else
{
$haComp->adaptor = $haComp->hibrydAuth->authenticate($_GET['provider']);
$haComp->userProfile = $haComp->adaptor->getUserProfile();
$haComp->login();
$this->redirect('create');
}
我该如何解决?感谢所有的目的......