Here is my code. It is working to auth but I don’t know how to get the cookie & store it for future requests. Please help me
var request = require(‘request’);
var headers = {
‘Content-Type’: ‘application/json’,
‘Accept’: ‘application/json’
};
var dataString = ‘{“usr":"example@gmail.com”,“pwd”:“12345678”}’;
var options = {
url: ‘https://demo.erpnext.com/api/method/login’,
method: ‘POST’,
headers: headers,
body: dataString
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
console.log(body);
}
}
request(options, callback);