douwo1517 2016-08-25 16:05
浏览 75
已采纳

设置未知属性:yii \ authclient \ AuthAction :: successCallBack

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;
    }

and this description error enter image description here

  • 写回答

1条回答 默认 最新

  • dpno17028 2016-08-26 08:23
    关注

    The property name is successCallback not successCallBack:

    'auth' => [
        'class' => 'yii\authclient\AuthAction',
        'successCallback' => [$this, 'successCallBack'],
    ],
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 CATIA有些零件打开直接单机确定终止
  • ¥15 请问有会的吗,用MATLAB做
  • ¥15 phython如何实现以下功能?查找同一用户名的消费金额合并—
  • ¥15 ARIMA模型时间序列预测用pathon解决
  • ¥15 孟德尔随机化怎样画共定位分析图
  • ¥18 模拟电路问题解答有偿速度
  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 误删注册表文件致win10无法开启
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序,怎么查看客户esp32板子上程序及烧录地址