Skip to content

[BUG] Dash with CSRFProtect from Flask-WTF no longer working after Dash 4.1 to 4.2 upgrade #3827

Description

@ghaarsma

After upgrading Dash 4.1.0 to Dash 4.2.0 (while keeping Flask-WTF at 1.3.0) the application no longer works and creates the following exception: flask_wtf.csrf.CSRFError: 400 Bad Request: The CSRF token is missing.

Everything is working fine under Dash 4.1.0. Under Dash 4.2.0 it creates the following exception during callback execution:

Traceback (mostrecentcalllast):
File"C:\Users\Python\dash_test4\venv\Lib\site-packages\flask_wtf\csrf.py", line286, inprotectvalidate_csrf(self._get_csrf_token())
~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^File"C:\Users\Python\dash_test4\venv\Lib\site-packages\flask_wtf\csrf.py", line102, invalidate_csrfraiseValidationError("The CSRF token is missing.")
wtforms.validators.ValidationError: TheCSRFtokenismissing.
Duringhandlingoftheaboveexception, anotherexceptionoccurred:
flask_wtf.csrf.CSRFError: 400BadRequest: TheCSRFtokenismissing.

A MRE to reproduce the problem is here:

dash_app.py

Image

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions