Node Express JS Cookies to Client

Viewed 11

i have an express app. Im trying to set cookies to client server address by doing so:

const token = jwt.sign({ userName: userName, id: user.id }, 'secret');
        console.log(token);
        res.cookie('user', token, { httpOnly: false, secure: false });
        res.status(200).send({
          success: true,
          message: 'Authorized',
          user: user,
        });

I have tried adding multiple options to res.cookie but doesnt work.

My goal is to set cookies with token to client address but it sets to server address.

0 Answers
Related