Netlify not setting cookies

Hello guys! I’m trying to use a login based on cookies using React Vite on the frontend (hosted on Netlify) and the backend with express using Railway because I wasn’t able to make it works here on Netlify, on mi localHost the cookie is set perfectly but on deploy it gets me an error on network saying i havent set the sameSite as Show on img 1 here.

On img2 you can see the route and the last img it’s the fetch I’m doing on the front

the site is https://treestore.netlify.app/

and the test credentials are:

Email: test@mail.com
Password: 1234

if someone can take a look it would be great! i have try on diferent browser, but nothing change!

Thanks!



Hi @robmrivas , the reason for your problem is quoted below

The issue is because the front end and backend are not on the same domain.
You can try the below to set the cookie to see if it works. Replace your_frontend_domain_here.com with your frontend domain url

const cookieOptions = {
        httpOnly: true,
        magAge: 60 * 60 * 1000
        sameSite: 'None',
        secure: true,
        domain: 'your_frontend_domain_here.com'
    };

    res.cookie('accessTokenCookie', accessToken, cookieOptions);
    res.send({ status: 'success'});