Yii2, Facebook, and Twig

I’m trying to build a rather simple site, and my biggest hurdle is getting facebook login working. I’m trying to use the authclient extension to log in with facebook. I’ve set everything up according to docs… but I don’t know how to initiate the process of logging in.

I’ve built a fb connect based on the sdk before and I’d really rather not… Now my next question, how do I access template functions in twig and plugins through a twig template?

Such as this:


<?= yii\authclient\widgets\AuthChoice::widget([

    'baseAuthUrl' => ['site/auth']

]); ?>

I’ve used cakephp before on a pretty big project, but I’m completely new to yii.

I find a practice with yii extensions is to describe how to install/configure the module but nothing on actually using it.

Well I decided twig wasn’t worth the time at this moment and I just dropped it.

Got going with AuthClient after some hours of research. The docs on yii as a whole suck. Including all the blogs :confused:

Coming in green it wasn’t easy haha.

This is all it took to get access to data coming back from facebook.


Yii::$app->get( 'authClientCollection' )->getClient( 'facebook' )->getUserAttributes();

From there I created an auto registration that throws the user in the database, which correctly worked with my mongo installs. Sweet.