I have my backend hosted on a server, for example, backend.vercel.app and the frontend on another server, for example, frontend.vercel.app
Whenever a user sends a request to the /login route, I am setting the cookie like this:
const setCookie = (req, res, token) => {
res.cookie('jwt', token, {
expires: new Date(Date.now() + process.env.JWT_COOKIE_EXPIRES_IN * 24 * 60 * 60 * 1000)
});
};
In the frontend, I am using axios to send a request to the backend.vercel.app/login route, with {withCredentials: true}
But, the cookie is not being set up, even after a successful login.
The cookies are there in the backend API, but not in the frontend: Image of available cookies
What am I missing?