string renderCsrfToken(string $tokenId)
Renders a CSRF token.
Use this helper for CSRF protection without the overhead of creating a form.
Check the token in your action using the same token ID.
$csrfProvider = $this->get('security.csrf.tokengenerator');
if (!$csrfProvider->isCsrfTokenValid('rmuser_'.$user->getId(), $token)) {
throw new \RuntimeException('CSRF attack detected.');
}
Please login to continue.