Tutorial by Examples

Go to the [https://developers.facebook.com/](https://developers.facebook.com/) and create your app. Click Add product and choose Facebook Login
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 comp...
Add button Login as facebook account to your login view: Edit site/login.php in views folder, add theses line to content of page login: <?= yii\authclient\widgets\AuthChoice::widget([ 'baseAuthUrl' => ['site/auth'], 'popupMode' => false, ]) ?> Above, we set that aut...
If you enable prettyUrl in your yii2-app, your redirect_uri will be: http://<base_url>/web/site/auth And disable pretty url: http://<base_url>/web/index.php?r=site%2Fauth Example:
/** * @param $client ClientInterface */ public function onAuthSuccess($client) { //Get user info /** @var array $attributes */ $attributes = $client->getUserAttributes(); $email = ArrayHelper::getValue($attributes, 'email'); //email info $id = ArrayHelper::getValue(...

Page 1 of 1