title: Angular 9 - cookie been saved on wrong domain
body: <p>My client side and server side run on different domains. 
  and when I do a login to the server I save the cookie on the response.
  but Angular save that cookie only for the client-side domain for some reason...</p>
  
  <p>Server:</p>
  
  <pre><code>const cookieParser = require('cookie-parser');
  router.post("/", (req, res) =&gt; {
    const userData = req.body;
    User.findOne(userData).then(data =&gt; {
      if (data) {
        const token = jwt.sign(userData, process.env.SECRET);
        res.cookie("token", token);
        res.send();
      } else {
        res.status(401).send("Login Failed");
      }
    });
  });
  </code></pre>
  
  <p>My client runs on localhost:4200
  and my server on localhost:3000
  (I tried it from completely different domains and still the same issue)</p>
  
  <p><a href="https://i.stack.imgur.com/1bZGh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1bZGh.png" alt="enter image description here"></a></p>
  
  <p>Also tried using ngx-cookie-service, but it's also only working with the client domain</p>