I need to send the x-csrf-token along with the URL in a GET request. I am using request-promise nodejs package for this purpose, but I don't know how to do.
I need to do something like this:
return rp({
method: 'GET',
url: "https://alabbo.to/joiner?fid=5ba900635da0a&page=check",
CSRF: "Y5KLHznEcspsqDHgmy63UHvKZT8s48EuQ1bfv34n"
})
.then(function (html) {
}
CSRF is sent inside headers with key name X-CSRF-Token
as shown below
return rp({
method: 'GET',
url: "https://alabbo.to/joiner?fid=5ba900635da0a&page=check",
headers: {
'X-CSRF-Token': "Y5KLHznEcspsqDHgmy63UHvKZT8s48EuQ1bfv34n"
}
}).then(function (html) {
})
Atishay is right, X-CSRF-Token is a header.
Otherway, is you use Node v8, you can use async / await instead of .then
.
const response = await rp({ method: 'GET', url: "https://alabbo.to/joiner?fid=5ba900635da0a&page=check", headers: { 'X-CSRF-Token': "Y5KLHznEcspsqDHgmy63UHvKZT8s48EuQ1bfv34n" } })
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.