Social Network Auth Events

The following is the list of the social network authentication events and where they happen:

On Controllers

How to Work With Social Network Auth Events

This event when triggered will contain a Da\User\Model\SocialNetworkAccount model instance and also the client used to authenticate throughout a social network. For example:

<?php 
// events.php file

use Da\User\Controller\SecurityController;
use Da\User\Event\SocialNetworkAuthEvent;
use yii\base\Event;

Event::on(
    SecurityController::class, 
    SocialNetworkAuthEvent::EVENT_BEFORE_CONNECT, 
    function (SocialNetworkAuthEvent $event) {

        $client = $event->getClient(); // $client is one of the Da\User\AuthClient\ clients
        $account = $event->getAccount(); // $account is a Da\User\Model\SocialNetworkAccount

        // ... your logic here
    });

For further information about how to authenticate via social networks and the available clients, please visit the guide

© 2amigos 2013-2017