I have this code in node js API :
const jwt = require("jsonwebtoken");
generateToken = (user, res) => {
  const token = jwt.sign(user, process.env.ACCESS_TOKEN_SECRET, {
    expiresIn: "1800s",
  });
  res
    .cookie("token", token, {
      httpOnly: true,
    })
    .status(200)
    .json({ message: "Logged in successfully  " });
};
module.exports = generateToken;
I have this code in Next js project :
const onSubmitLogin = (data) => {
  
    axios
      .post(
        `http://localhost:8000/login`,
        {
          email: data.email,
          password: data.password,
        },
        {
          headers: {
            "Content-Type": "application/json; charset=UTF-8",
          },
        }
      )
      .then(function (response) {
        console.log(response);
      })
      .catch(function (error) {
        console.log(error);
      });
   
  };
If I use Postman, i get the cookie with the token.
But, when I use the browser I dont get the cookie stored in cookies.
I tried to add withCredentials: true, in axios request but nothing changes.
However, I get the message "Logged in successfully " in the browser's console