csrf failed errors for Flask-wtf based login form csrf failed errors for Flask-wtf based login form flask flask

csrf failed errors for Flask-wtf based login form


Try replacing {{form.csrf_token}} by {{form.hidden_tag()}}

My hypothesis is that chrome is not sending the csrf_value of the hidden tag.

To check if this hypothesis is right, you need to check what you are getting at flask.request.form["csrf_token"] after posting the form. If you get nothing, then my hypothesis is probably right.

As for what might be causing it, I know that in XHTML you cannot nest input elements within the form element. That is why Flask-WTF has a special way of adding hidden tags, see this doc page.