Reputation: 13
I have a little problem with the token in django.
When I write a POST form and add {{csrf_token}}, when I submit it the token is checked .
But when I send a POST request (in ajax) and add the paramater manually csrfmiddlewaretoken , the token is not checked.
But I don't know why ?
Thanks.
Upvotes: 1
Views: 545
Reputation: 599470
AJAX requests are not checked for CSRF: the browser's same origin policy means that CSRF attacks are much harder. See the explanation in the docs.
Upvotes: 6