OctoberCMS login with multiple websites in same browser
I have been using OctoberCMS and I found this very useful indeed.
However, I have come across one strange thing which I want to share with you guys.
Additionally, both the websites have two different databases and those databases are in my local server only. (I am using XAMPP on Windows machine).
Now the interesting part is, If I login to website1 and then I login to website2, and go back to website1, then I am automatically getting logged out of it.
I just wonder, why is this happening? Or, Is this how OctoberCMS works? Or Do I need to make sure something which I have not done yet?
I just checked app.php file from both the websites and checked the
key values of both the websites and I found those are different.
Any thoughts ?
This is happening because the cookie created is called
october_session and it's set on the
localhost domain. In other words, the same cookie and domain for both of your sites.
You can solve this in one of two ways:
1) You can set up virtual hosts in xampp so that your sites are something like http://website1.localhost and http://website2.localhost -- this way a separate
october_session cookie will be set on each 'domain'.
2) You can go to
config/session.php and change the line
'cookie' => 'october_session', so a different cookie name for each site.
- → OctoberCMS Backend Loging Hash Error
- → "failed to open stream" error when executing "migrate:make"
- → OctoberCMS - How to make collapsible list default to active only on non-mobile
- → Create plugin that makes objects from model in back-end
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → How to install console for plugin development in October CMS
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → How to update data attribute on Ajax complete
- → October CMS - Conditionally Load a Different Page