Forums

CSRF cookie not set.

I have deployed my website and when I login I get the following message: CSRF cookie not set. According to the message I need to do one of the following things:

  • Your browser is accepting cookies. --> Done
  • The view function passes a request to the template's render method. --> Done
  • In the template, there is a {% csrf_token %} template tag inside each POST form that targets an internal URL. --> Done
  • If you are not using CsrfViewMiddleware, then you must use csrf_protect on any views that use the csrf_token template tag, as well as those that accept the POST data. --> I use CsrfMiddleware (it is in my settings)
  • The form has a valid CSRF token. After logging in in another browser tab or hitting the back button after a login, you may need to reload the page with the form, because the token is rotated after a login. --> form has a token

What should I do to make it work?

What web app is this for and can you share a page that has the behaviour?