I am attempting to post an AJAX request to a controller method...
I have done the following per the instructions on https://book.cakephp.org/3.0/en/controllers/components/csrf.html#csrf-protection-and-ajax-requests
public function beforeFilter(Event $event)
{
$this->Security->config('unlockedActions', ['galleryReorder']);
if (in_array($this->request->action, ['galleryReorder'])) {
$this->eventManager()->off($this->Csrf);
}
return parent::beforeFilter($event);
}
However, the beforeFilter method does not seem to be firing, and I continue to get a CSRF Token Mismatch...
Any ideas on what I could be doing wrong?
Thank you