Aleksandr
Aleksandr

Reputation: 528

Can't set cookie in Chrome Dev tools on localhost

I'm trying to set (change) cookie in Chrome Dev tool, but it only stores the name, not the value.

Steps:

  1. open page at localhost:3000
  2. open dev tools
  3. add new cookie
  4. set name
  5. set value
  6. refresh page

Actual result: the cookie with its name is there, but value is empty.

Funny part - this was working a couple of days ago, can't think of what has changed since then.

OS - MacOS v. 10.14.3 Chrome - v. 73.0.3683.86 (Official Build) (64-bit)

Also I noticed the cookie is highlighted in red color (see MyCookie on the screenshot).

not being able to set cookie in dev tools

Setting cookie for this page works just fine in Firefox.

Already tried:

  1. open page from 127.0.0.1:3000 instead of localhost
  2. restart chrome
  3. restart OS

Upvotes: 12

Views: 17327

Answers (3)

bekanur98
bekanur98

Reputation: 520

opened chrome://flags and set the value of "Partitioned Cookies" to Enabled" and relaunched the browser. After that the red row did not appear and I am able to set the cookies like before.

Upvotes: 9

Aleksandr
Aleksandr

Reputation: 528

Turned out I have to set an expiration date for MyCookie (all this in DevTools). However, this is confusing because:

  1. I'm pretty much sure it worked without an expiation date before.
  2. i18next cookie has no expiration date and sits there just fine.

Upvotes: 4

ayyappa maddi
ayyappa maddi

Reputation: 941

With the new versin of chrome Max-age of cooke can set in following way using
dev tools -> console set document.cookie manually.
document.cookie='token=1234'.
We will get following things Cookie Name: token
Cookie Value: 1234
Expires / Max-Age: 2019-12-26T15:22:22.000Z

Upvotes: 8

Related Questions