Answer the question
In order to leave comments, you need to log in
How to make a request from server to server?
How to make a request from server to server (API) where cookies are used as auth and not jwt
Answer the question
In order to leave comments, you need to log in
First you need to log in to server 2 and save cookies in a variable (cookie)
Then, with each request to server 2, substitute cookies in the header
// запрос с сервера 1
const options = {
url: ' http://server2.com',
method: 'POST',
headers: {
'Cookie': cookie // cookie - то что вы получили в куки при авторизации на сервере http://server2.com
...
}
};
request(options, (err, res, data) =>{
...
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question