Can't send cookies in header to backend deployed on heroku, but can send on localhost without any code change

Viewed 26

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());
    });
0 Answers
Related