In my Nodejs backend deployed on heroku
app.use(cookieParser())
app.use(cors({
origin:"http://localhost:3000",
credentials:true,
}))
In react js running on localhost
axios
.get(`${api}/api/v1/logged`, { withCredentials: true })
.then((res) => {
console.log(res);
dispatcher(Setlogin());
})
.catch((err) => {
dispatcher(Setlogout());
});