cURL CSRF Token

后端 未结 3 1808
無奈伤痛
無奈伤痛 2020-12-30 17:57

I few months ago, my colleague created an calendar subscription by getting the work schedule. I believe he has done this by cURL.

Now I\'m building a website to have

3条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-30 18:44

    The idea behind CSRF defense is based around generating a unique token for each page load which you have to pass with the form.

    You will have to load the page with the form, extract the token from the page and pass that along with the POST request. Typically, after any attempt, the token is invalidated and you must request the form again to get a new token.

    The CSRF token is stored in the session, so the server can see if the one generated on the form matches the one supplied with the request sending the form.

提交回复
热议问题