CSRF with fetch API |
I tried adding it (to the code I posted earlier), but it broke everything. This is what I got in the logs:
#0 C:\laragon\www\stostolov\vendor\codeigniter4\framework\system\Security\Security.php(233): CodeIgniter\Security\Exceptions\SecurityException::forDisallowedAction() #1 C:\laragon\www\stostolov\vendor\codeigniter4\framework\system\Filters\CSRF.php(85): CodeIgniter\Security\Security->CSRFVerify(Object(CodeIgniter\HTTP\IncomingRequest)) #2 C:\laragon\www\stostolov\vendor\codeigniter4\framework\system\Filters\Filters.php(173): CodeIgniter\Filters\CSRF->before(Object(CodeIgniter\HTTP\IncomingRequest), NULL) #3 C:\laragon\www\stostolov\vendor\codeigniter4\framework\system\CodeIgniter.php(378): CodeIgniter\Filters\Filters->run('front/fetchProd...', 'before') #4 C:\laragon\www\stostolov\vendor\codeigniter4\framework\system\CodeIgniter.php(308): CodeIgniter\CodeIgniter->handleRequest(NULL, Object(Config\Cache), false) #5 C:\laragon\www\stostolov\public\index.php(45): CodeIgniter\CodeIgniter->run() Also I tried to simply include the csrf value in the body (see below) - but it didn't work either. fetch(SITE_CONSTANT+'/whatever', { method: "post", body: csrf_val }).then(response => console.log(response))
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
|
Messages In This Thread |
CSRF with fetch API - by Leo - 07-01-2020, 11:04 AM
RE: CSRF with fetch API - by MGatner - 07-07-2020, 10:26 AM
RE: CSRF with fetch API - by Leo - 07-07-2020, 12:51 PM
RE: CSRF with fetch API - by MGatner - 07-07-2020, 04:20 PM
RE: CSRF with fetch API - by Leo - 07-08-2020, 08:41 AM
RE: CSRF with fetch API - by InsiteFX - 07-08-2020, 11:40 AM
|