User auth not working for custom provider

Hi,

I’ve written custom wrapper for Facebook authentication. Working correctly.

I’ve faced one issue: when I change session driver to database Facebook login does not work.

The code:


case UserIdentity::ERROR_NONE:

    Yii::app()->user->login($identity, 0);

break;

Session config:


'session' => array(

            'autoCreateSessionTable' => false,

            'autoStart' => true,

            'connectionID' => 'db',

            'class' => 'CDbHttpSession',

            'sessionTableName' => 'Session'

        ),

Yii::app()->user->login($identity, 0); returns true, but user is not logged in. I suppose there’s some session problem.

Username/password login works correctly.

Any ideas how to debug/solve? :)

Same issue is for cache session driver.

I’m out of clues totally - it’s for sure something session related :)

Still no luck.

Tried hundreds of time: Yii::app()->user->login() returns true, user is being logged in, but after page reload it is not.

It works perfectly with session stored in APC, native, but DOES NOT work while sessions are stored in DB.

Any suggestions?

Problem solved by adding




if( false === Yii::app()->session->isStarted )

            Yii::app()->session->open();



to the Controller component.

But why autoStart in config is being ignored?

Cheers for that, I’ve been having the exact same problem!

Did you put it under beforeAction() in the Controller file?