Cookie doesn't set with 'secure' flag on HTTPS - JavaScript

0 投票
最新提问 用户: (1.4k 分)

I'm trying to set document.cookie with secure flag, like this:

document.cookie = 'token=hR_lVjFDKAUbuRRKmNCSZ3mlvpcWi1sA; expires=Fri, 31 Dec 9999 23:59:59 GMT; domain=; path=/; secure';

But it doesn't work at (which equals to domain attribute in desirable cookie string). Please help to understand what's wrong.

发表于 用户: (220 分)
the secure come has come secured from the server that cannot be set on the client


0 投票
最新回答 用户: (1.4k 分)

It was my fault. I need to set domain as instead of as I tried before.

欢迎来到 Security Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。