Yii2: AuthClient error id

Created on 5 Jan 2015  ·  7Comments  ·  Source: yiisoft/yii2

Hi,
need help
the after install AuthClient for yii2
do not access users/registration

ERRiOR

Invalid Configuration – yii\base\InvalidConfigException

Missing required parameter "id" when instantiating "yii\authclient\AuthAction".

config file add

'clients' => [
    'facebook' => [
        'class' => 'yii\authclient\clients\Facebook',
        'clientId' => 'secret',
        'clientSecret' => 'secret',
    ],
],

Controller add

public function actions()
{
    return [
        'auth' => [
            'class' => 'yii\authclient\AuthAction',
            'successCallback' => [$this, 'successCallback'],
        ],
    ];
}
public function actionRegistration()
{
    $model = new Shopuser();
    return $this->render('registration');
}
public function successCallback($client)
{
    $attributes = $client->getUserAttributes();
    // user login or signup comes here
}

view file add

<?= yii\authclient\widgets\AuthChoice::widget([
'baseAuthUrl' => ['users/registrations']
]) ?>

Tell me what I not so made

Тhanks!

composer add

"yiisoft/yii2-authclient": "2.0.*@dev"
authclient to be verified

Most helpful comment

Спасибо за совет! Поставил на чистую, хотя была тоже, фактически чистая.
Оказалось, что я просто do insert in this section

public function behaviors()
    {
        return [

и get error! А нужно insert in action method

    public function actions()
    {
        return [

So good works!

Спасибо!

All 7 comments

Unable to reproduce.
@nik4152, please use Official Yii forum to ask a questions - GitHub is a bug tracking system.

already working need to be removed config file

'authClientCollection' => [
            'class' => 'yii\authclient\Collection',
            'clients' => [
                'facebook' => [
                    'class' => 'yii\authclient\clients\Facebook',
                    'clientId' => 'xxxxxx',
                    'clientSecret' => 'xxxxxx',
                ],
            ],
        ],

and through time back and it worked
glitch )
I do not know why but it works thanks

but i need solution. I dont see that it works

@Skit what are you talking about? Можно по-русски

Не смог разобраться почему получаю исключение: Missing required parameter "id" when instantiating "yii\authclient\AuthAction". Всё как у ТС
Спасибо, за ответ.

Не смог воспроизвести. Есть есть способ воспроизвести на чистой установке - пожалуйста, поделитесь.

Спасибо за совет! Поставил на чистую, хотя была тоже, фактически чистая.
Оказалось, что я просто do insert in this section

public function behaviors()
    {
        return [

и get error! А нужно insert in action method

    public function actions()
    {
        return [

So good works!

Спасибо!

Was this page helpful?
0 / 5 - 0 ratings