title: Symfony 4 - how to add csrf token without building form?
body: <p>I am reading tutorial here </p>
  
  <p><a href="https://symfony.com/doc/current/form/csrf_protection.html" rel="noreferrer">https://symfony.com/doc/current/form/csrf_protection.html</a></p>
  
  <p>how to add csrf token. It says to use </p>
  
  <pre><code>form_end()
  </code></pre>
  
  <p>in the template. But this is not working, gives error:</p>
  
  <blockquote>
    <p>Type error: Too few arguments to function
    Symfony\Component\Form\FormRenderer::renderBlock(), 0 passed in
    E:\projektai\php
    projektai\htdocs\mokomieji\symfony_4_demo\var\cache\dev\twig\bb\bb2248f7be504240fcc2ab43dabf593090ebc4c897ce72b1a979082d62914b47.php
    on line 48 and at least 2 expected</p>
  </blockquote>
  
  <p>Here is answer which shows how to fix but it is only when you have form object built:</p>
  
  <p><a href="https://stackoverflow.com/questions/45568847/symfony-type-error-too-few-arguments-to-function-formrendererrenderblock">Symfony Type error: Too few arguments to function FormRenderer::renderBlock()</a></p>
  
  <p>How to do this without having form object? Here is login from login documentation page:</p>
  
  <pre><code>{% if error %}
      &lt;div&gt;{{ error.messageKey|trans(error.messageData, 'security') }}&lt;/div&gt;
  {% endif %}
  
  &lt;form action="{{ path('login') }}" method="post"&gt;
      &lt;label for="username"&gt;Username:&lt;/label&gt;
      &lt;input type="text" id="username" name="_username" value="{{ last_username }}" /&gt;
  
      &lt;label for="password"&gt;Password:&lt;/label&gt;
      &lt;input type="password" id="password" name="_password" /&gt;
  
      &lt;button type="submit"&gt;Login&lt;/button&gt;
  
  {{  form_end() }}
  </code></pre>