I am trying to use Angularjs in order to retrieve the csrf token from one of the response\'s header and set it on all requests.
I h
I think you can do it like this in config function:
.config(['$httpProvider', function($httpProvider) {
$httpProvider.defaults.xsrfHeaderName = 'X-CSRF-TOKEN';
$httpProvider.interceptors.push(function() {
return {
response: function(response) {
$httpProvider.defaults.headers.common['X-CSRF-TOKEN'] = response.headers('X-CSRF-TOKEN');
return response;
}
}
});
}]);