cancel
Showing results for 
Search instead for 
Did you mean: 

Can't login to admin - get invalid form key

Can't login to admin - get invalid form key

I moved magento from the root folder, to /shop directory. For the past 24 hours I was fine logging into the admin panel, this morning I was fine but as of this afternoon I have not been able to login and get 'invalid form key. please refresh page'

 

Most suggestions out there suggest clearing the cache and sessions as well as web browsers cache and I have done this. 

 

I have also made sure all these have the correct path: 

web/secure/base
web/unsecure/base
web/cookie/cookie_domain
web/cookie/cookie_path

 

Anything else that I am missing that I could try?

 

3 REPLIES 3

Re: Can't login to admin - get invalid form key

Not even a suggestion on were to look? 

 

How can I disable to form key temporarily? I need to get into the store, if I can't fix this problem short of a re-install/re-set than I will likely just migrate to mage 2, but If I am migrating to mage2 in the meantime I need to login and get to the invoices in order to ship product. 

 

Any help advice, anything...

 

 

Re: Can't login to admin - get invalid form key

Maybe you have problem of session handler, if you use files, making sure you can write to that folder, please check my blog post

that cover all cases

 

Fixing invalid form key when logging in magento admin

Re: Can't login to admin - get invalid form key

Hi, specific to copying or moving Magento, and your copy is on a different domain name: If you are receiving the error 'Invalid form key. Please refresh the page.' and all the other solutions out there are not fixing your problem, it is likely the "cookie domain" is being seen as your old domain name instead of the new.

 

To fix this issue try updating any references to your old domain name to the new in the Varien.php file:

/<magento html dir>/app/code/core/Mage/Core/Model/Session/Abstract/Varien.php

 

After updating the Varien.php file, run a reindex (can use the n98-magerun tool) and a few other commands to update things:

 

n98-magerun cache:clean
n98-magerun cache:flush
n98-magerun sys:setup:run
n98-magerun index:reindex:all 

 

Worked in Magento 1

 

Good luck!