Sign Up(register) or login an accont with facebook.

[size="5"]Hello All, I have been working on a Yii2 application for some months now. I am almost complete with the application but I have an Issue.

In this app, I want my Users to login or sign up with Facebook. I have gone through alot of material on the web in other to do this.

I have config the config/web.php as follows

components’ => [

'authClientCollection' => [

    'class' => 'yiiauthclientCollection',

    'clients' => [

        'facebook' => [

            'class' => 'yiiauthclientclientsFacebook',

            'clientId' => 'facebook_client_id',

            'clientSecret' => 'facebook_client_secret',






in my siteController, I have done the following.

public function actions()


    return [

        'auth' =>[

        'class' =>'yiiauthclientAuthAction',

        'successCallback' =>[$this, 'successCallback'],




public function actionSuccessCallback($authclient)


    $attributes = $client->getUserAttributes();

    return var_dump($attributes);

    // user login or signup[size="6"][/size] comes here


but I cant get the Current facebook User in other to get the data from the facebook sdk so as to use it for registration.

I get the following error message

Call to a member function getUserAttributes() on a non-object

please how do I handle this ?? or is ther anyone with a better proposition ???

Thanks in advance[/size]

I have it working in an OpenSource project so you can get some ideas: