Magento Forum

{"error”:true,"error_msg”:"Invalid Form Key"}
 
jemoon
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-09-30
Gdansk, Poland
 

Hi,
I’m using default template for backend so I don’t think that this issue is connected with that - I suppose that there is some mistake in js/mage/adminhtml/loader.js but I don’t know java enough to solve this problem.

Edit:
This problemwas just reported as a bug so all of you who have those problems please support this bug by putting you comments about this problem. Bug is reported here : Form_Key Bug

 
Magento Community Magento Community
Magento Community
Magento Community
 
jemoon
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-09-30
Gdansk, Poland
 

Hi,
Finally I have found a reasonable solution. It just requires to edit one line in /app/design/adminhtml/default/default/template/page/head.phtml - change:

var FORM_KEY '<?php echo $this->getFormKey() ?>';
for this:
var FORM_KEY '<?php echo Mage::getSingleton('core/session')->getFormKey() ?>';
I know that it should be done in other, more convienient way but I think that it’s good for now.
 
Magento Community Magento Community
Magento Community
Magento Community
 
i960
Guru
 
Avatar
Total Posts:  633
Joined:  2007-10-01
Bakersfield, CA
 

That works!  Thank you. grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
Galaxy Of Vitality
Jr. Member
 
Avatar
Total Posts:  27
Joined:  2008-04-01
 

Once again Jemoon, Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pixxa
Sr. Member
 
Total Posts:  275
Joined:  2008-10-23
 

Yeah! That one really worked out well smile

Kudo’s to Jemoon!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Fibo
Sr. Member
 
Avatar
Total Posts:  107
Joined:  2008-06-25
Marseille, France
 

1 - I had the same problem and finally decided to copy most files from a clean new copy.

2 - If you look at /app/design/frontend/XXX/defaul/layout/core.xml you will eventually find a hint as this ¤$µ¤ form_key which is in fact generated in /app/design/frontend/XXX/defaul/tempalet/core/formkey.phtml where it is simply the following html code:

<input name="form_key" type="hidden" value="<?php echo Mage::getSingleton('core/session')->getFormKey() ?>" />

3 - I think that after several troubled updates/upgrades from Magento, and where most often Magento’s team answer is “we cannot reproduce this behaviour” (uderstand: “and we are not going to make any effort to solve that now, we just let the forums do te research”), my strategy for next upgrade will be:
a - backup everyfile, bakup the database
b - do the upgrade
c - check php.ini, htaccess; check rights for /js/index.php
d - check if it works, looking at new elements in /var/report/
e - if something fail that should not… don’t waste time, Magento upgrade did fail as usually: do a download of the complete version to your machine, then upload selected pieces or everything

Steps a and b are normal required steps for any upgrade process for any software
Step c and e come from the fact that Magento upgrades seem to deliberately ignore that we don’t have the same system than they have
Note that there is a very fuzzy area as far as access rights to directories and files are concerned: Magento updates seem to create directories with chmod 777, something that most host providers block, 755 would be more appropriate! same for files, they are usually created 666 while 644 would work the same.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LibrisMusicae
Jr. Member
 
Total Posts:  7
Joined:  2008-10-27
 

thank Jemoon. It works partially for me.

I can check Categories and articles without any problem.

But when I try to import a csv file the Key_Form problem is still occuring.

Here is the problem

FORM_KEY is not defined

initialize()(function(), “http://localhost/magento/index.php/admin/system_convert_gui/batchRun/?isAjax=true”, Object method=post parameters=Object)index.ph...loader.js (ligne 4370)
wrap()()index.ph...loader.js (ligne 248)
klass()index.ph...loader.js (ligne 51)
sendImportData(Object batch_id=31 rows[]=[1])import-2..._file.csv (ligne 74)
execImportData()import-2..._file.csv (ligne 51)
import-20090104171435-1_file.csv()()import-2..._file.csv (ligne 113)
[Break on this error] this.options.parameters.form_key = FORM_KEY;

Unfortunately I’m not a “computer person” more a financial one.

Can anyone help me about this problem?

Thanks.

Nicolas

 
Magento Community Magento Community
Magento Community
Magento Community
 
LibrisMusicae
Jr. Member
 
Total Posts:  7
Joined:  2008-10-27
 

Note that I didn’t even have the previous Var Key_Form ligne in the phtml file. WHen I had it, it partially works…

Only this importing file problem

 
Magento Community Magento Community
Magento Community
Magento Community
 
jemoon
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-09-30
Gdansk, Poland
 

Hi,
LibrisMusicae As for now I can’t help you because I can’t reproduce this problem.
Thanks to Fibo’s clues about form_key I can assume that this problem occurs for people who are using their own design and skin template (not the default template located at /app/design/frontend/default/..... and skin located at skin/frontend/default/....) I think that as soon as the dev team will release the diff file we will manage to solve this issue completly.

 
Magento Community Magento Community
Magento Community
Magento Community
 
andreladocruz
Guru
 
Total Posts:  322
Joined:  2008-05-07
Brazil
 

sirs,
the problem is still occuring....

if you have filtered the order grid (by status ie) and, in other browser session, someone changes the status of one order listed in the filter, the error occurs.

another way is in session and that the ajax don´t send you back to log in page.

regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pixxa
Sr. Member
 
Total Posts:  275
Joined:  2008-10-23
 

Ok, editted to sp to not solved.

 
Magento Community Magento Community
Magento Community
Magento Community
 
thE_iNviNciblE
Sr. Member
 
Avatar
Total Posts:  220
Joined:  2008-01-09
Oldenburg
 
Livefish.com.au - 31 December 2008 01:24 AM

Chay - 31 December 2008 12:07 AM
Update:  Fixed this issue by clearing my browser cache / cookies.

Thanks Chay, that fixed it for me.

that works also for me…

is it possible that something get looked after update.... rebuild of an index?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jemoon
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-09-30
Gdansk, Poland
 

Hi,
For all of you who cant fix this please support this bug here: Form_Key Bug

 
Magento Community Magento Community
Magento Community
Magento Community
 
Project M
Jr. Member
 
Total Posts:  14
Joined:  2008-10-13
 

Just a look at my /app/design/adminhtml/default/default/template/page/head.phtml, i noticed that i was also missing the Form Key line, it seems the files wasn’t updated with the upgrade.

I just copied over a /app/design/adminhtml/default/default/template/page/head.phtml file from a Magento 1.2.0.1 Full Release Zip and everything seems to work fine now…

 
Magento Community Magento Community
Magento Community
Magento Community
 
jemoon
Sr. Member
 
Avatar
Total Posts:  128
Joined:  2008-09-30
Gdansk, Poland
 

Hi,
After another round with this problem I found that Fooman Speedster Extension was causing all those problems in my case. Now everything works fine with non changed head.phtml

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top