php - Having issue with authclient in Yii2 -


i integrated social authentication based on tutorial:

http://stuff.cebe.cc/yii2docs/guide-security-auth-clients.html

here configuration file:

'authclientcollection' => [     'class' => 'yii\authclient\collection',     'clients' => [         'facebook' => [             'class' => 'yii\authclient\clients\facebook',             'clientid' => 'my_id',             'clientsecret' => 'my_secret',         ],         'linkedin' => [             'class' => 'yii\authclient\clients\linkedin',             'clientid' => 'my_id',             'clientsecret' => 'my_secret',         ],     ], ], 

my problem is, when click on social buttons redirects login page. tried that:

   public function onauthsuccess($client) {       $attributes = $client->getuserattributes();         die(print_r($attributes));         ... 

even doesn't work me, 302 redirects login page.

what might issue?

maybe getting access_denied error ? because default when get request oauth server contain error parameter , if equal access_denied, authaction redirects user cancelurl default loginurl.

try set 'cancelurl' => url::to(['site/login', $_get]) in auth action configuration, , check $_get parameters oauth server in url after redirect

also redirect cancelurl happens if oauthclient cannot fetch accesstoken


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -