Hi folks,
I am using Drupal 7 to configure a new single Drupal site that uses two languages (English and French), using Locale with the "Language domain" setting enabled. This site requires both the display and the admin language to be switchable, and almost have it working! I have just one last issue.
The problem:
When I visit "en.dev.example.com" I can log in everything seems to be working great. But, when I switch to "fr.dev.example.com" while logged in, I no longer am logged in. I can actually have two different users logged in at once, using the same browser, on each domain.
This is not desired! This Drupal site is not a multi-site, and I don't want it to behave like that. When someone logs in to the site in either language, I need them to stay logged in regardless of if they switch languages. This is because many users will be totally bilingual, and will need to see both languages of the site content, much of which is membership based.
Here's what I have done so far:
I started out setting the "Path prefix language code" in my language settings which was working well -- you could switch languages no problem, and stay logged in while doing so. Perfect! Except....
I had to change the method of handling languages to "Language domain" because the URLs created by some modules (namely the Advanced Forum module, but I am sure it will come up in other places) were not respecting the path language prefixes, and giving many 404s. I really need to use the subdomain method!
I created two subdomains via my hosting account, one is "en.dev.example.com" and the other is "fr.dev.example.com" (both using subdomains to give each language equal significance). I changed the "Language domain" for each language, and am now able to see both language versions by using the subdomains I created, as expected.
My question:
What can I do to make sure users stay logged in when they switch language after starting their session, while using the "Language domain" option?
I cannot locate any info or forum posts for Drupal 7 on this particular issue... Do I need to make some changes to my settings.php file? I also couldn't find D7 documentation on setting this up (only for path prefixes), so it's possible that I have missed a step.
I have been at the languages settings for a few days now, and I have made real progress, but feel totally stuck at this point, the last problem! I would absolutely love some advice at this point.
Thank you.
Comments
Found a related issue in the Drupal core Issue queue
I am not experiencing nearly as many of the problems as this person, but I did see that they are also having the logged in and logged out issue.
http://drupal.org/node/1436078
cookie_domain in settings.php
This should just work uncommenting and adapting cookie_domain in settings.php:
Changing languages should not matter as long as you're logged in on the same main domain, so this should work for the domains you mentioned (but not across site1.com and site2.com).
cookie_domain in settings.php was the answer!
Thank you for taking the time to answer my question! Your suggestion was the answer I was looking for, and I had not located this tip anywhere else. You have made my day (and my week!) - Such a simple thing to overlook.
Thank you so much! :-)
Can it be used with localhost
Can it be used with localhost ?
Regards,
Jramby.
Try host.local or alikes
Source
You can try "anything.local" (add it to /etc/hosts, and to ServerAlias/ServerName in your Apache configuration)
Drupal 8?
What's the answer here for Drupal 8?
Having the same issue as you.
Having the same issue as you. Have you found a solution to this apart from SSO?