Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Symfony UX LiveComponent Invalid CSRF TOKEN?!#61093

Unanswered
woweya asked this question inQ&A
Discussion options

Hello everyone,

I have a question regarding Symfony UX Live Components and forms.

Context:

Imagine you have a Parent Component and a nested Child Component.Both areLive Components and both includeSymfony FORMS (FormBuilder). However, the submit button for the child’s form is located in the Parent Component, and I use a LiveComponent emit to dispatch an event that the child’s save method listens for.

Although the event arrives correctly, I get an Invalid CSRF-TOKEN error coming from the child component.

While investigating, I discovered that Turbo UX uses the csrf_protection_controller.js Stimulus controller to generate a CSRF token. What does this imply? Must I disable Symfony’s default CSRF token handling for forms?

In my csrf.yaml, I currently have:

# Enable stateless CSRF protection for forms and logins/logoutsframework:form:csrf_protection:token_id:submitcsrf_protection:check_header:truestateless_token_ids:# - submit            -authenticate            -logout

When I disable the submit entry under stateless_token_ids, the form no longer raises a CSRF error. If I inspect the Symfony Profiler (under the child’s save request → Forms), it shows :

Screenshot 2025-07-10 alle 13 30 03

Does the CSRF token still exist, and should I therefore leave submit disabled in csrf.yaml?

Why aren’t there clear references or documentation explaining that Turbo UX uses its own controller for token generation and CSRF handling?

Thank you very much!

You must be logged in to vote

Replies: 0 comments

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
1 participant
@woweya

[8]ページ先頭

©2009-2025 Movatter.jp