CSRF token missing or invalid Django

前端 未结 1 1088
借酒劲吻你
借酒劲吻你 2020-12-12 02:27

I\'ve run into this issue before and solved it, but this just popped up totally randomly (or so it seems). I\'ve just come back to my Django project after a little while aw

相关标签:
1条回答
  • 2020-12-12 02:55

    For security purposes, the CSRF token is changed ('rotated') when you log in. If you open a page in Tab A, then log in on Tab B, then attempt to submit the form in Tab A, you will get a CSRF error, because the CSRF token in Tab A is out of date.

    When you refresh Tab A, a new CSRF token is loaded, and the errors will stop.

    0 讨论(0)
提交回复
热议问题