ajax csrf regenerate |
hii i just try to make csrf regenrate in ajax request is this the right way??
add <?php echo csrf_meta(); ?> in head tag and in every response must include csrf_hash(); return $this->response->setJSON(['status' => true, 'message' => 'Hello World', 'csrf' => csrf_hash()]); Code: <script type="text/javascript">
Makitweb - How to Send AJAX request with CSRF token in CodeIgniter 4
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
(03-01-2022, 01:18 AM)InsiteFX Wrote: Makitweb - How to Send AJAX request with CSRF token in CodeIgniter 4 btw i want ask how if i make csrf regenerate to false?? are that any problem i use codeigniter 4.1.9
You can read more about it here.
CodeIgniter 4 User Guide - Security - Cross-site request forgery (CSRF) What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|
Welcome Guest, Not a member yet? Register Sign In |