I’m trying to implement authentication, I store JWT token in session and send it with every request and I use cookie-session. All worked fine on localhost, but when I deploy my app with vercel, the server can only receive an undefined
req.session
. The browser told me that my session don’t have sameSite attribute, so it sets to default value – lax
. but apparently, I had already set that in my server.
This is the code of my express server:
app.use(
cookieSession({
name: "session",
keys: ["somecookiesecretkey"],
signed: false,
maxAge: 24 * 60 * 60 * 1000,
cookie: {
sameSite: "None",
secure: true,
},
})
);
And this is the warning that browser told me.
warning: sameSite is not set
I have tried to turn off third-party block in Chrome setting. I also tried to flat the cookie object:
app.use(
cookieSession({
name: "session",
keys: ["somecookiesecretkey"],
signed: false,
maxAge: 24 * 60 * 60 * 1000,
sameSite: "None",
secure: true,
})
);