I'm using React + Next js on the frontend, Node.JS Express on the backend. While working on localhost, I was able to set cookies in backend response. But when I moved it to digitalocean, I could not perform this operation. I am working on the same server, two different ports and the same domain, but the cookies are not set.
Backend response
res.cookie("auth-token", result.token + ';', {
secure: true,
httpOnly: true,
expires: new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 7)),
sameSite: "none",
domain: ".xxxx.com"
}).cookie("username", result.username + ';', {
secure: true,
httpOnly: true,
expires: new Date(new Date().getTime() + (1000 * 60 * 60 * 24 * 7)),
sameSite: "none",
domain: ".xxxx.com"
}).send(new BaseResponse(result, true));
Set cookies are being set but there is no record in the cookies section. Also FE side, i am using {withCrediantials:true} for request with axios
axios.post(`${AppConstants.REST_PROVIDER}/login`, {
code: code,
password: password
}, { withCredentials: true }).then(d => {
Cookie permissions granted on Chrome. I tried everything but failed. Can you help with why it works on localhost and does not work on the domain on the server?