symfony: Twig function csrf_token('authenticate') returns 'csrf_token'
Symfony version(s) affected
7.2.0
Description
I am building a login form according to instructions here https://symfony.com/doc/current/security.html#form-login
When I make the following code:
<input type="hidden" name="_csrf_token" value="{{ csrf_token('authenticate') }}">
The function csrf_token('authenticate') generates thes tring csrf_token instead of an actual token. Making my login not work.
By comparison, executing csrf_token('randomstring') does generate a valid token.
What is happening here?
How to reproduce
Seems to be as simple as doing csrf_token('authenticate') in Twig.
Possible Solution
No response
Additional Context
No response
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 2
- Comments: 27 (6 by maintainers)
Oh, this might be something to add to the doc, right? PR welcome!
Definitely
Le sam. 7 déc. 2024 à 15:35, Thibault G. @.***> a écrit :
@cavias I tried to reproduce it on a fresh 7.2 simple project with a protected page and login form and the login worked with the stateless csrf with string “csrf-token”