0

I am creating a cookie 'sample' from a.website.com and after that, I am redirecting to b.website.com in the same window.I have set the cookie domain as top level 'website.com' and the path is '/'. When I open the chrome developer console of the website b.website.com, I did not see the cookie 'sample'. Can you suggest me what I am missing here? Is document.cookie different than a $cookie in Angular 1.x?

Raja K

kulls
  • 845
  • 2
  • 12
  • 37
  • Your request is similar to this other one- https://stackoverflow.com/q/3342140/8569576. – Anson W Han Oct 26 '17 at 01:29
  • The same behavior applies for subdomains, unless they are set at the top level domain – Anson W Han Oct 26 '17 at 01:30
  • Thanks. I am storing in the top level domain. It's not showing when I redirect – kulls Oct 26 '17 at 02:12
  • But the cookie in your description is being created while on a.website.com, not website.com. Hence, it's lost on site switch. – Anson W Han Oct 26 '17 at 02:15
  • Thanks. Yes, that's the concern. what would be the solution. Is the approach is wrong? – kulls Oct 26 '17 at 02:59
  • Is document.cookie different than a $cookie in angular? – kulls Oct 26 '17 at 03:18
  • depending on the parameters you use in your setters/getters, both document.cookie and $cookie can be accessing/setting the same actual cookie. The issue here isn't how you set or get the cookie, but from which website you set it. The cookie needs to be created while on the top level domain, website.com. Then a user's session in either a.website.com or b.website.com can get that cookie and read the values. – Anson W Han Oct 26 '17 at 14:44

0 Answers0