While making json request from backbone.js app, I'm getting an error:
CSRF verification failed. Request aborted.
I have set the X-CRSF-TOKEN
, but still it showing 403 forbidden
error .
In backbone,js app i have the following code:
$.ajaxPrefilter( function( options, originalOptions, jqXHR ) {
options.xhrFields = {
withCredentials: true
};
// If we have a csrf token send it through with the next request
console.log("that.get('_csrf')");
console.log(that.get('_csrf'));
if(typeof that.get('_csrf') !== 'undefined') {
jqXHR.setRequestHeader('X-CSRF-Token', that.get('_csrf'));
}
});
},
In console i have the crsf token value:
X-CSRF-Token:V30RZC23TQ015YQO5KCKCPI2RWSTWIOH