Cant send cookie at res when user using Safari/iOS

22 Views Asked by At

With a web server build with Node.js and Express.js I'm attaching the cookies at the response

res.cookie('token', token, {
    httpOnly: true,
    expires: new Date(Date.now() + sixMonths),
    secure: true,
    sameSite: 'none',
    signed: true,
  });

When a user uses chrome or mozilla everything works at expected, but on safari getting an auth error because can't handle cross-over cookies, any solution?

solve express cookie problem

1

There are 1 best solutions below

1
AudioBubble On

Currently you're setting sameSite: 'none', so you're telling your session you're going to work with crossed domains. To make this work, add the value sameSite: true