user2993539
user2993539

Reputation: 505

Why is cookie not set with express?

I use node js with express for my server side and react for client side. My app worked for a while without problems but all of a sudden a problem occured with saving token in the signed cookies. The problem occurs also in develop environment and in localhost.

This is how I set the cookie with express:

res.cookie('jwt', jwt, {
     httpOnly: false,
      sameSite: "None",
      signed: true,
      secure: false,
      expires: new Date(Date.now() + 60 * 60 * 1000 * 24 * 14)
    }

I also use cookie-parser.

In the client side I use axios with withCredentials = true.

When I look at the browser and also when debugging server side I cant see any cookies.

Upvotes: 0

Views: 333

Answers (1)

nakzyu
nakzyu

Reputation: 206

Due to recent chrome update(https://chromestatus.com/feature/5633521622188032),if "SameSite=None" included in cookies, setcookies doesn't work anymore.

JWT should be embeded in response body.

Upvotes: 1

Related Questions