My guess would be that you want to have a form which is not checked by the CSRF protection feature.
Even though I don’t understand why you would need to have such a thing (because its a safety feature) you can of course achieve what you want via setting a bit more config.
So in your case adjust your middleware method inside your src/Application.php
public function middleware(MiddlewareQueue $middlewareQueue): MiddlewareQueue
{
$csrf = new CsrfProtectionMiddleware();
// Token check will be skipped when callback returns `true`.
$csrf->skipCheckCallback(function ($request) {
$controller = $request->getParam('controller');
$action = $request->getParam('action');
$plugin = $request->getParam('plugin');
// Skip token check for API URLs.
if ($controller === 'Forums' && $action === 'index') {
return true;
}
});
$middlewareQueue
// Here are your already present ->add() calls which should basically stay the same
// BUT you have to replace the already present CsrfProtectionMiddleware instance with your new one from above
->add($csrf);
return $middlewareQueue;
}