React JS and Cakephp intergration

How to submit react form to CakePHP API ?

I got an error CSRF token mismatch Please any one do this in any project will helpful for me.

CSRF token only invoked when you send POST request from AJAX Api, So you need to set X-CSRF-TOKEN Header in ajax side or You can disable CSRF token for particular routes.

If you send GET Request then you can easily get response without CSRF Token Exception, because cakephp auto-detect Request Header, Request is Ajax or POST. So You can many ways to handle this task @spadeX. You can disable CSRF Token on particular Route or Set X-CSRF-TOKEN in header.

How can i disable the particular route. ? i tried this follwoing but not worked.

$routes->scope('/', function (RouteBuilder $builder) {
        $builder->scope('/ContactDetails/add', function (RouteBuilder $routes) {
$csrf = new CsrfProtectionMiddleware();

            // Token check will be skipped when callback returns `true`.
            $csrf->skipCheckCallback(function ($request) {
                // Skip token check for API URLs.
                if ($request->getParam('prefix') === 'ContactDetails') {
                    return true;

what is wrong i am’s not worked…

It May not working @spadeX man! You are using (PREFIX) key word for ‘ContactDefaults’… router scope are ‘/’ root scope, so how does it Prefix scope here? so now you can add some code here like this and try it…
$path = $request->getPath();
if(strpos($path, ‘/ContactDetails/add’) === 0):
return true
now test it… May it will work or not Im’t sure but try it yourself.