[英]Yii2: authclient
I've used Yii 2 authclient in my app and when i try it , it gives me 我在我的应用程序中使用过Yii 2 authclient ,当我尝试它时,它给了我
Unknown component ID: authClientCollection 未知的组件ID:authClientCollection
the code i used in config\\main.php 我在config \\ main.php中使用的代码
'facebook' => [
'class' => 'yii\authclient\clients\Facebook',
'authUrl' => 'https://www.facebook.com/dialog/oauth?display=popup',
'clientId' => ' my app id from facebook',
'clientSecret' => 'My App Secret',
],
in login page : 在登录页面:
<?= yii\authclient\widgets\authChoice::widget(['baseAuthUrl'=>['site/auth']]) ?>
any help please . 请帮忙。
You need to wrap this configuration in 您需要将此配置包装在
'authClientCollection' => [
'class' => 'yii\authclient\Collection',
'clients' => [
// add your facebook config here
],
],
which is CLEARLY stated in documentation . 在文档中明确指出 。
Try like so, 这样尝试
'facebook' => [
'class' => yii\authclient\clients\Facebook::class,
'clientId' => 'YOUR_FACEBOOK_CLIENT_ID',
'clientSecret' => 'YOUR_FACEBOOK_CLIENT_SECRET',
'scope' => 'email,public_profile',
'attributeNames' => [
'name',
'email',
'first_name',
'last_name',
]
]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.