3

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. 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 Second image

and also i am attached my full code this is on my 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

 'authClientCollection' => [
        'class' => 'yii\authclient\Collection',
        'clients' => [
               'facebook' =>[
                 'class' => 'yii\authclient\clients\Facebook',                      
                  'clientId' => '********',
                  'clientSecret' => '**********',
            ],
        ],
    ],

..please help me.. Thanks

mathi
  • 107
  • 1
  • 11
  • I too have a same problem To give some more explanation The control is not transferred to `yii\auth\client\AuthAction` ``` 'auth' => [ 'class' => 'yii\authclient\AuthAction', 'successCallback' => [$this, 'successCallback'], ], ``` – indianwebdevil Feb 23 '16 at 05:13

1 Answers1

4

Make sure that in your behaviours() you allow access to the action "auth" in your SiteController.php

So your rules should look something like:

'rules' => [
    [
        'actions' => [ 'login', 'error', 'auth' ],
        'allow'   => true,
    ],
    [
        'actions' => [ 'logout', 'index' ],
        'allow'   => true,
        'roles'   => [ '@' ],
    ],
],
keeg
  • 3,990
  • 8
  • 49
  • 97
  • Glad to hear it. Please accept the answer so that others may benefit. – keeg Feb 24 '16 at 15:34
  • 1
    HI @mathi: Please accept this answer as it solved your problem. "*..Thank you so much it's working fine now...... – @mathi*" And, if you don't know how to accept answer. Please go through it http://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work. – Nana Partykar Mar 29 '16 at 10:55