Js-cookie: none/secure value for sameSite attribute?

Created on 31 Jul 2020  ·  4Comments  ·  Source: js-cookie/js-cookie

The readme lists the possible values for the sameSite attribute as lax or strict, but Chrome 84 is throwing me a message that says

A future release of Chrome will only deliver cookies with cross-site requests if they are set with SameSite=None and Secure.

Without js-cookie saying "none" is an option to set sameSite to, is this what I'm expected to use to apply it with the secure option?

Cookies.set( 'cookie_name', 'value', { sameSite: 'None;', Secure: true })

This returns cookie_name=value; path=/; sameSite=None; Secure.

bug

Most helpful comment

Just to notice don't try to test {sameSite: 'none', secure: true} while developing on localhost because it is not https and your cookie will not get set at all.

All 4 comments

Documentation is outdated (back then there was no “None”). Use “None”.

Thanks for the response, @carhartl.

Usage of the "none" value also requires there to be a "Secure" attribute. Is the solution I provided above the expected way I should accomplish this?

Here's what I would expect:

Cookies.set('name', 'value', { sameSite: 'None', secure: true })

Just to notice don't try to test {sameSite: 'none', secure: true} while developing on localhost because it is not https and your cookie will not get set at all.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jiangdefu picture jiangdefu  ·  3Comments

DeadcatDev picture DeadcatDev  ·  3Comments

Neve12ende12 picture Neve12ende12  ·  3Comments

navin11 picture navin11  ·  4Comments

FagnerMartinsBrack picture FagnerMartinsBrack  ·  9Comments