Skip to main content
1 of 2
Robin Schambach
  • 19.8k
  • 1
  • 20
  • 45

In Craft 3 the csrf token validation in the general.php config is set to true by default. In order to request your controller with post requests you have to turn it off or include the token

https://github.com/craftcms/docs/blob/v3/en/changes-in-craft-3.md#csrf-token-params

{% set csrfTokenName = craft.app.config.general.csrfTokenName %}         
{% set csrfToken = craft.app.request.csrfToken %}     
<input type="hidden" name="{{ csrfTokenName }}" value="{{ csrfToken }}">
Robin Schambach
  • 19.8k
  • 1
  • 20
  • 45