I have several subdomains like ‘a.domain.com’,‘b.domain.com’ but I found that if i login at subdomain a, session/cookies won’t work in b, and i have to login again in ‘b.domain.com’
How do I make login work in all subdomains? My site is going to run on the net, so it’s very urgent question. Can anyone help me out?
In addition to extending CWebUser, make sure to set the ‘id’ of your app in the config to be the same for all the sub sites, and then configure the cookie settings / session name in your components. Here is an example from a test setup I did:
I tried to follow the guide and I believe I did well. But I still can’t get it right. Whatever my settings are, once I set ‘domain’ => ‘.mydomain.com’ in cookieParams login will not work even on one single page.
Question solved. Should already be solved after taking Matt Kelliher’s advice, just because I forgot to clear the browser’s old cookies after i changed the setting