React front end, trying to post to the server side, however I get a Error: CSRF token missing
import Cookies from 'js-cookie';
....
const xsrfCookie = Cookies.get('XSRF-TOKEN');
const headers = new Headers({
'XSRF-TOKEN': xsrfCookie,
'_csrf': xsrfCookie,
});
console.log("formdata",formData)
const res = await fetch('/postAttempts', {
method: 'POST',
headers,
credentials: 'include',
body: JSON.stringify(formData),
})
From the controller
exports.postAttempts = function(req, res) {
console.log(req);
console.log(req.body);
res.json({data: 'hi'});
};
Am I incorrectly pulling the csrf token?
React front end, trying to post to the server side, however I get a Error: CSRF token missing
From the controller
Am I incorrectly pulling the csrf token?