Quantcast
Viewing all articles
Browse latest Browse all 2

Symfony forms returning CSRF token is invalid from AJAX requests

We have a Symfony 4.3 app which has a page which makes multiple AJAX requests. Each AJAX response contains a few forms and each form has its own CSRF token. However, only one of the AJAX calls manages to store it's token in the session. Therefore all forms in the AJAX requests will fail with the message

The CSRF token is invalid. Please try to resubmit the form.

Except for one form which manages to have its token saved correctly in the session.

The session is stored in redis.

How can I make sure all CSRF tokens are stored in the session when making multiple AJAX calls?


Viewing all articles
Browse latest Browse all 2

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>