After_login event not called with cookie based login

Hello Folks,

I’m facing a problem were my afterLogin event is only called with classic login, but not with loginByCookie.

Does any one have a clue ?



Nobody has any idea ?

I’m using the following bootstrap :

namespace frontend\events;

use yii\base\BootstrapInterface;

class UserEvents implements BootstrapInterface{

public function bootstrap($app){

    $app->user->on(\common\models\User::EVENT_BEFORE_LOGIN,['common\models\User', 'beforeLogin']);

    $app->user->on(\common\models\User::EVENT_AFTER_LOGIN,['common\models\User', 'afterLogin']);

    $app->user->on(\common\models\User::EVENT_BEFORE_LOGOUT,['common\models\User', 'beforeLogout']);



I found it finaly.

I put it in the common bootstrap, before any other, the second bootstrap was already calling Yii::$app->user->getIdentity(), and so login in by cookie if necessary.