The question may seem weird, but let me show what I mean:
Here, you post your credentials as the body of a post request, and then the response will somehow set a cookie that you passed into the header. It uses curl that I don't have any experience with, and trying to earn the same with node. I was trying to set it as a variable, but it didn't work:
const fetch = require('node-fetch')
let cookie = ''
const auth = () => fetch(
`${URL}/rest/authenticate`, {
method: 'POST',
body: JSON.stringify(credentials),
headers: {
cookie
}
}
);
I was searching for the same problem mentioned by someone else, but couldn't really find anything.
How can I set the cookies this way to a variable, or even a local file in node like in the example linked?