[英]Yii2 framework facebook and google login using authclient not working
i have followed the instruction here http://www.yiiframework.com/doc-2.0/yii-authclient-authaction.html .. and it's not working for me.. i am using yii2 authclient for social website facebook and google login ...it's not working for me. 我按照这里的说明http://www.yiiframework.com/doc-2.0/yii-authclient-authaction.html ..它不适合我..我正在使用yii2 authclient社交网站facebook和谷歌登录。 ..对我不起作用。 i am attached screen short .it's my login page 我附短片。这是我的登录页面
after clicking facebook or google button again the same page appeard in next new window pls see the image 再次点击Facebook或谷歌按钮后,在下一个新窗口中显示相同的页面,请参阅图像
and also i am attached my full code this is on my controller.php 而且我附上了我的完整代码,这是在我的controller.php上
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallback' => [$this, 'successCallback'],
],
];
}
and this is on view page 这是在浏览页面上
<?=
yii\authclient\widgets\AuthChoice::widget([
'baseAuthUrl' => ['site/auth']
]); ?>
and this on my config directory main.php file 这在我的配置目录main.php文件中
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'facebook' =>[
'class' => 'yii\authclient\clients\Facebook',
'clientId' => '********',
'clientSecret' => '**********',
],
],
],
..please help me.. Thanks ..请帮助我..谢谢
Make sure that in your behaviours()
you allow access to the action "auth" in your SiteController.php 确保在您的behaviours()
允许访问SiteController.php中的“auth”操作
So your rules
should look something like: 所以你的rules
应该是这样的:
'rules' => [
[
'actions' => [ 'login', 'error', 'auth' ],
'allow' => true,
],
[
'actions' => [ 'logout', 'index' ],
'allow' => true,
'roles' => [ '@' ],
],
],
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.