Sunday, May 29, 2011

Error: Bad Request The CSRF token could not be verified

Error: Bad Request The CSRF token could not be verified

Just got the above error while submitting a form in my Yii powered SaaS app. I realized that the form isn't generated by Yii, but was customized. Hence I had to add a hidden field:

echo CHtml::hiddenField('YII_CSRF_TOKEN',Yii::app()->request->csrfToken);

No comments: