I want to make several apps on the same website that aren’t related. They share, however, the user table which have info about the users.
Now, should I make them as separate Yii web app or not.
If I make them as several Yii web app the user have to log in again when he wants use a different app from the one he was using. With all in one Yii web app it saves the same authentication cookie for all the apps and he only has to log in one time.
But the intuitive solution would be to make several Yii web app as they aren’t related and then I probably will encounter some problems if I don’t do so.
How will the apps be organized? Will they receive their own subdomains or are they just in different directories? In later case, you can set a login cookie for the entire domain and implement single signon for all apps.
They will be in different directories. How can I set the login cookie for the entire domain?
See CWebUser.identityCookie and CHttpCookie.path. You should be able to access that in your app’s config here:
I tested now with two different apps using the default demo for both username and password.
I used the following code:
// enable cookie-based authentication
But it didn’t work.
It seems that the cookie content depends on the application.
The cookies name and content are the following:
content: 62cc6c7710 …
content: 3f3947830d …
Set $stateKeyPrefix of CWebUser the same for both apps.