Hi Support team, I deployed my react app on netlify which has backend deployed on fly.io. My backend uses JWTs saved as cookies as an authentication system. When somone logs in successsfully, they should get cookie in browser. It works fine on local host but after deploying on netlify, my browser does not receive cookies. I’m not sure what the issue is.
This is my back end login controller
This is my front end api request
export async function login(user: Partial): Promise {
try {
const response = await fetch(${root}login
, {
method: “POST”,
headers: { “Content-Type”: “application/json” },
body: JSON.stringify(user),
credentials: “include”,
});
const loggedUser = await response.json();
if (response.ok) {
const { token } = loggedUser;
document.cookie = auth=${token}; path=/; HttpOnly
;
}
return loggedUser;
} catch (error) {
console.log(error);
}
}
Any help would be greatly appreciated.