Before install this extension, you must install yii2-app. In this example, I use yii2-basic template. Guide for installation in here.
Run
composer require --prefer-dist yiisoft/yii2-authclient
or add
"yiisoft/yii2-authclient": "~2.1.0"
to the require
section of your composer.json
.
Add config authClientCollection
to your config components
:
return [
'components' => [
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'clientId' => 'facebook_client_id',
'clientSecret' => 'facebook_client_secret',
],
],
]
],
// ...
];
facebook_client_id
is application id and facebook_client_secret
is app secret.