Sessions Across Subdomains in Express
Some thoughts:
Try removing the period from .example.com
. My thought here is that you're trying to set a subdomain-only cookie, while still on the root domain. I have read that cookies set on example.com
will be available on all subdomains, too.
Try not redirecting the user to a subdomain immediately, to first verify that the cookie is working on your root domain. Inspect the response headers from your server, then see whether your browser kept the cookie in the next request. Only when you're sure this is working correctly navigate to the subdomain.