Ajax CSRF Token Mismatch on Making Changes

I have an open form where it sends an Ajax request to the jquery onchange event, sometimes due to the number of requests sent in a period of time, I start getting a TokenMismatchException.

I use the following method to send the csrf token:

$.ajaxSetup({ 

   headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } 

});

What will be the solution to my situation? Extending the life of csrf tokens? Thoughts?

+4
source share
1 answer

If the call does not process any sensitive information, put the route with the exception of the array in the VerifyCsrfToken class.

0
source

All Articles