I’m using the Uniform plugin for Kirby (latest version) and my contact form always fails with the error:
“The CSRF token was invalid.”
What I’ve checked so far:
-
The form includes
<input type="hidden" name="uniform-token" value="<?= csrf() ?>">
-
Only one Uniform form is on the page
-
The session cookie (
kirby_session
/PHPSESSID
) stays the same from page load to POST -
The CSRF token value in the form and the POST request matches
-
The Uniform form is created once per request in the controller and passed into the snippet
-
No
new Form()
in the snippet -
'cache.pages.active' => false
and'session.mode' => 'kirby'
are set inconfig.php
-
/site/cache/
and/site/sessions/
are empty/cleared -
Tested in different browsers and private tabs
-
Uniform is up to date
What happens:
-
Submitting the form always triggers “The CSRF token was invalid.”
-
I verified in DevTools that the token and session cookies are correctly submitted
Question:
I am absolutely stumped and stuck. Pretty sure its something absolutely obvious. @mzur do you have any ideas?
Any help or pointers appreciated!