CSRF token issue magento 2

Extend the following file

vendor/magento/framework/App/Request/CsrfValidator.php

and add the following code

if ( $request->getModuleName() == 'MODULENAME') {
            return; // Skip CSRF check
        }