my problem is in the rendering of the token in the template twig
when i display the getEnvironment ()
the token are well generated
but impossible to access the values.
By default, Slim\Csrf\Guard will generate a fresh name/value pair after each request. This is an important security measure for certain situations. However, in many cases this is unnecessary, and a single token throughout the user’s session will suffice. By using per-session requests it becomes easier, for example, to process AJAX requests without having to retrieve a new CSRF token (by reloading the page or making a separate request) after each request. See issue #49.`
Just enable the persitent token mode to keep the token:
it is true that I asked myself the question of whether it was useful to implement session security with the csrf. https://scotthelme.co.uk/csrf-is-really-dead/
and your function is sexy. my problem was that my tpl did not return the keys
thank you for your advice