I was trying to test my API in DJango, but while trying to use a POST request to create a user, the following error shows up:
"detail": "CSRF Failed: CSRF token missing."
What should I do? Can I remove this? Or how should I pass the CSRF also in testing and in production? In theory, I put the false in CSRF_COOKIE_SECURE, so, I don't know what to do.
CodePudding user response:
you have to add CSRF token to the request(and postman):
data: { csrfmiddlewaretoken: csrf_token, "username": "thesamething", "email": "thesamething", "password": "thesamething" }