authentication across different subdomain

hi,

currently i have several subdomains, named www.mysite.com and acp.mysite.com (admin control panel), and account-based subdomains

the problem is, when i have logged-in in www.mysite.com, and i browse the acp.mysite.com, yii requested for authentication again.

what should i change in order to make yii only authenticate once for different subdomains?

thanks :)

note:

i only tried this in localhost, aliasing the 127.0.0.0 as www.mysite.com and acp.mysite.com - but i assume it won’t be different in the production environment

Hello, I’m not 100% sure but it might has to do with the domain property in the session cookie.

Try this in config:




...

'components' => array(

   ...

   'session' => array(

      'cookieParams' => array('domain' => '.example.com'),

   ),

   ...

),

...



yeap now it’s working! :)

thanks man, you’re a life saver ;)

One my also add:




...

'components' => array(

   ...

   'user' => array(

      'identityCookie' => array('domain' => '.example.com'),

   ),

   ...

),

...