Codeigniter with jqGrid: use csrf_token

强颜欢笑 提交于 2019-12-09 03:30:31

First it's necessary to understand CSRF:

http://www.beheist.com/index.php/en/blog/csrf-protection-in-codeigniter-2-0-a-closer-look

From that post:

"The Security class generates a unique value for the CSRF token with each HTTP request. When the object is created, the name and value of the token are set."

What is possibly happening (I'm not familiar with jqGrid) is each form is possibly getting it's own CSRF token. Or, it's possible that there is only one token for all the forms. Either way, CodeIgniter expects one token per HTTP request and response. Basically, you need to close the loop on the first request to create the page, and the POST of the data.

Therefore, you may need to dig into the jqGrid code and the CI view to make sure that your output generates the CSRF token as desired.

Update: One of the comments on the blog above had a link to Ajax CSRF problems: http://aymsystems.com/ajax-csrf-protection-codeigniter-20

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!