title: How to use OWASP CSRF Protector to every POST request via AJAX?
body: <p>Hello stackoverflow community,</p>
  
  <p>I searched in google a method to protect my website HTTP POST requests from csrf attacks and i found the OWASP CSRF Protector project, i place the page link in case someone don't know what is : <a href="https://github.com/mebjas/CSRF-Protector-PHP/wiki/How-to-use" rel="nofollow noreferrer">click here</a> to check in git reposity. I followed the guide as the author of the above page explains but doesnt seems to work cause i cant make an ajax request with success and i don't have either an error message to understand what goes wrong.</p>
  
  <p>To conclude, i downloaded the OWASP CSRF Protector library, i placed to my config file a <code>CSRFP_TOKEN</code> and also in each php page the following code at the begin of each page:</p>
  
  <pre><code>&lt;php    
      include_once __DIR__ .'/libs/csrf/csrfprotector.php';
  
      //Initialise CSRFGuard library
      csrfProtector::init();
  
  ?&gt;
  </code></pre>
  
  <p>Does anyone know what else i should do, maybe attach this csrf token to each form, creating a <code>SESSION</code> and how to do something like that.</p>
  
  <p>PS-> The token can be static or do i need to change it dynamically</p>
  
  <p>Thank you in advance!</p>