When I try login using social media in Yii2 if google, facebook, twitter and GitHub error. I'm sure is true for my configuration on \basic_yii2\config\web.php. This my configuration :
<?php
$params = require(__DIR__ . '/params.php');
$config = [
'id' => 'basic',
'basePath' => dirname(__DIR__),
'bootstrap' => ['log'],
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'google' => [
'class' => 'yii\authclient\clients\Google',
'clientId' => 'example',
'clientSecret' => 'example',
],
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'clientId' => 'example',
'clientSecret' => 'example',
],
'twitter' => [
'class' => 'yii\authclient\clients\Twitter',
'consumerKey' => 'example',
'consumerSecret' => 'example',
],
'github' => [
'class' => 'yii\authclient\clients\Github',
'clientId' => 'example',
'clientSecret' => 'example',
],
],
],
and this my configuration for \basic_yii2\controllers\siteConttroler.php :
public function actions()
{
return [
'error' => [
'class' => 'yii\web\ErrorAction',
],
'captcha' => [
'class' => 'yii\captcha\CaptchaAction',
'fixedVerifyCode' => YII_ENV ? 'testme' : null,
],
'auth' => [
'class' => 'yii\authclient\AuthAction',
'successCallBack' => [$this, 'successCallBack'],
],
];
}
public function successCallBack($client)
{
// get user data from client
$userAttributes = $client->getUserAttributes();
print_r($userAttributes);
exit;
}