So, I have a frontend vite app hosted on Netlify (link), and a backend api written in express hosted on Railway. When testing locally, the server is able to set cookies during redirect for Google OAuth. However, in production, it does not seem to work. The Set-Cookie header is present, however the cookie isn't set. The code for setting the cookie is the following.
res.cookie("refresh_token", googleUserData.tokens.refreshToken, {
httpOnly: true,
secure: true,
maxAge: refreshTokenMaxAge,
sameSite: "none",
});
Tested on localhost, everything worked fine. After deploying, cookies are not being set by the backend hosted on Railway.