Cakephp 3.5.6 disable CSRF Middleware for controller
I'm trying to disable the CSRF check for a single controller (API), but I'm unable to find how I'm able to achieve this. The pre 3.5.0 CSRF Component had the ability to be disabled on certain request using: $this->eventManager()->off($this->Csrf); There are two ways to do that. Apply the middleware to specific routing scopes (or even routes) Depending on what routes you create, you can apply the middleware to specific scopes only, for example: // config/routes.php use Cake\Http\Middleware\CsrfProtectionMiddleware; Router::scope('/', function ($routes) { $routes->registerMiddleware('csrf', new