0

I am setting my cookie as follows:

document.cookie =`${name}=${value};expires=${expires.toUTCString()};path=/`;

and it works.

However recently I got a request that other corss subdomain access to the cookie is not allowed and that is why I am adding the domain as a path and when I set it as follows:

document.cookie =`${name}=${value};expires=${expires.toUTCString()};path=/`+ServiceUrls.prototype.getDomainUrl();

I cannot see it saved as a cookie. Is there anything wrong with what I am doing?

Hamed Minaee
  • 2,190
  • 3
  • 22
  • 55
  • Possible dupe of https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain#answer-23086139 – Kyle Miller Feb 01 '19 at 14:53
  • @KyleMiller Hi Kyle. that is part of the issue but not all. I am not sure why I can not see the cookie saved at all. So in the first place when I add path rather than / the cookie wont get saved – Hamed Minaee Feb 01 '19 at 14:56
  • You need to have it set as a Header option in the request vs setting it in JS – Kyle Miller Feb 01 '19 at 16:16
  • Later on in the question this looks to have a possible solution: https://stackoverflow.com/questions/18492576/share-cookie-between-subdomain-and-domain#answer-46434609 – Kyle Miller Feb 01 '19 at 16:19

0 Answers0