hearsid / hackerrank-scrapper

Get hackerrank solutions of problems you have solved.
10 stars 3 forks source link

How to get the CSRF token and cookie? #7

Closed bhishanpdl closed 4 years ago

bhishanpdl commented 4 years ago

I came to this github repo after reading the article on hackernoon and tried to replicate the work.

Following is mentioned there:

2. Login to your hackerrank account and copy the CSRF token and cookie from the headers of any of XHR request. (You can check the same in the network tab of chrome devtools)

I still am not sure how to get the CSRF and cookie from there.

How is my credentials.py looks like?

# file:  credentials.py

CSRF_TOKEN = "1234xxx"
COOKIE = "1234xxx"

I am not sure how to get the values of csrf and cookie.

When I right click > inspect > network There is no columns for csrftoken and cookie.

Only there are columns like Name, Status, Type etc. I am very new to the world of world scraping so if this is a very basic question ignore my ignorance.

hearsid commented 4 years ago

Just go to any of the XHR request in network tab after logging in to your hackerrank account, the CSRF token and cookie will be present in all of the request headers. If you are unable to find it, I will advice just browse little through the HTTP calls in the network tab and you will be able to find, request headers and these values easily.