We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
React front end, trying to post to the server side. However I get an "Error: CSRF token missing"
import Cookies from 'js-cookie'; .... async submitForm() { console.log('submitting form'); console.log(this.state); const formData = { checkinData: this.state.checkinData, }; 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 setting the csrf token in the header?
The text was updated successfully, but these errors were encountered:
This project isn't based on react. You may have a better answer from one of the react support groups.
Sorry, something went wrong.
No branches or pull requests
React front end, trying to post to the server side.
However I get an "Error: CSRF token missing"
From the controller
Am I incorrectly setting the csrf token in the header?
The text was updated successfully, but these errors were encountered: