0

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) {
    }
Jerlam
  • 943
  • 2
  • 12
  • 31

2 Answers2

1

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 Jain
  • 1,425
  • 12
  • 22
  • 1
    Yes indeed it makes sense. But I actually fixed my issue thanks to this post: https://stackoverflow.com/questions/21177387/caution-provisional-headers-are-shown-in-chrome-debugger I did not even need a token, it was simply not working because my adblock blocked the request... – Jerlam Sep 26 '18 at 07:18
0

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" } })

Dimitri
  • 922
  • 2
  • 13
  • 34