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 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器