How Postman auto generates cookies from a domain?

I’m executing a request on Node.JS that returns me an error, but in Postman i noticed that it works. The reason is that Postman auto generates a cookie and if I get this cookie generated and set in my Node JS code, it also works.

My question is: How postman do this? Can i do this in node js?