HowTo: Fix Invalid Security Token Error

While trying to add a new cms category or page in prestashop, the ‘invalid security token’ page appears. To know what went wrong, let’s have a look at the URL. The ampersand is displayed as html encoded ‘&’ so it couldn’t be interpreted correctly.

Workaround:

Replace the wrong syntax in the following file ‘controllers/admin/AdminCmsController.php’

'href' => self::$currentIndex.'&add'.$this->table.'&id_cms_category='.(int)$this->id_cms_category.'&token='.$this->token,

with

 'href' => self::$currentIndex.'&add'.$this->table.'&id_cms_category='.(int)$this->id_cms_category.'&token='.$this->token,

Now change the ‘controllers/admin/AdminCmsCategoriesController.php’

$this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');

to

 $this->toolbar_btn['new']['href'] .= '&id_parent='.(int)Tools::getValue('id_cms_category');

Done

5 Responses to HowTo: Fix Invalid Security Token Error

  1. Thank you for this article I was going nuts trying to figure out what is wrong. I had to read at least 10 before coming to yours. This fix was very easy and now I am happily creating pages. Cheers!

  2. Hello,
    I have the follow token prob in: controller=AdminModules&token=4ed12b….
    I receive a blank 500 error page. The other menu’s are working fine.
    Best Regards,
    Roger

Leave a reply

*