title: Cookies are not saved in the browser
body: <p>As a start I want to say that I already read almost everything regarding this issue and so far there is no resolution.</p>
  <p>In short I have a Node.js API server running on localhost:3000. I also have an Angular 10 app running on localhost:4200. The problem is simple - I make a request to localhost:3000/api/users/login and receive the following:
  <a href="https://i.stack.imgur.com/sF9XE.png" rel="nofollow noreferrer">server-response</a></p>
  <p>However there is no cookie saved as you can see here: <a href="https://i.stack.imgur.com/VjbXY.png" rel="nofollow noreferrer">empty-cookies</a></p>
  <p>As a result every subsequent request be it POST or GET is without headers and the server cannot recognize the user.
  So far I tried:</p>
  <ul>
  <li>including the { withCredentials: true } to the http requests from angular</li>
  <li>changing the cookie to http: false</li>
  <li>setting the domain in the cookies to various stuff like '.app.localhost'</li>
  <li>adding sameSite: 'none' to the cookie</li>
  <li>searching for the cookie on localhost:3000 where the API is running</li>
  <li>changing the origin in cors to '*' or removing it entirely</li>
  <li>tried all these things in Edge as well(otherwise I use Chrome)</li>
  </ul>
  <p>Unfortunately none of these things worked for me. Otherwise the login and registration are done succesfully and I can see the data in mongo.</p>
  <p>Here I will add the snippets of the code I use:</p>
  <pre><code>const app = express();
  app.use(express.json());
  app.use(cookieParser(config.cookieSecret));
  app.use(express.static(path.resolve(__basedir, 'static')));
  app.use(cors({
    origin: config.origin,
    credentials: true
  }));
  app.use('/api', apiRouter);
  app.use(errorHandler);
  </code></pre>
  <p>This is the login handler in which I set the cookie:</p>
  <pre><code>async function login(req, res, next) {
  const { email, password } = req.body;
  try {
      let user = await User.findOne({ email });
      const match = await user.matchPassword(password);
      if (!match) {
          res.status(401)
              .send({ message: 'Wrong username or password' });
          return
      }
      user = bsonToJson(user);
      const token = utils.jwt.createToken({ id: user._id });
      if (process.env.NODE_ENV === 'production') {
          res.cookie(authCookieName, token, { httpOnly: true, sameSite: 'none', secure: true })
      } else {
          res.cookie(authCookieName, token, { httpOnly: true })
      }
      res.status(200).send(user);
  } catch (err) {
      next(err);
  }
  </code></pre>
  <p>}</p>
  <p>And here is the Angular part:</p>
  <pre><code>loginMet(data) {
  return this.http.post('http://localhost:3000/api/users/login', data, {withCredentials: true});
  </code></pre>
  <p>}</p>