Magento 1 Invalid Form Key

When login to Magento 1 Admin area, i get an error

Invalid Form Key. Please refresh the page.

magento 1 login error

This is because the value of web/cookie/cookie_domain set wrong. This should be the current domain name.

MariaDB [goipshop]> select * from core_config_data where path like 'web/cookie/cookie_domain';
| config_id | scope   | scope_id | path                     | value        |
|       413 | default |        0 | web/cookie/cookie_domain | |
1 row in set (0.002 sec)

MariaDB [goipshop]> 

In this case, the domain name was different.

To see the value, you can run

select * from core_config_data where path like 'web/cookie/cookie_path';
select * from core_config_data where path like 'web/cookie/cookie_domain';

You can leave cookie domain value empty with command

update core_config_data set value="" where path="web/cookie/cookie_domain";

Or just delete the entry from MySQL table core_config_data with SQL commands

DELETE FROM core_config_data WHERE path='web/cookie/cookie_domain';
DELETE FROM core_config_data WHERE path='web/cookie/cookie_path';

Once this is done, you need to clear the cache with the command

rm -rf var/cache/ var/session/

Also clear browser cache or test in a private (incognito) browser

See Magento

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *