I am sending CSRF token in header while making an ajax request.
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': getCookie("XSRF-TOKEN")
}
});
In the above code I am getting the token from "XSRF-TOKEN
" cookie and setting in "X-CSRF_TOKEN
" header globaly for all ajax requests.
I've checked in chrome developers tool that this header is being sent.
But Laravel still throws TokenMismatch exception.
Note I can not get token from html like meta tag or input fields becuase html content is being cached therefore I would like to set use "XSRF-TOKEN" cookie that laravel sets in every response.