Invalid Form Key. Please refresh the page. on magento admin login page

48,130

Solution 1

I am sure that problems came from session storage & cookie setting.

You should follow below:

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

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

Delete all directories from below folders:

/var/session
/var/cache

Solution 2

While working on localhost can not sign in or create Account - ubuntu OS

Invalid Form Key. Please refresh the page.

invalid key error solve

change this value in your php.ini file

max_input_time : 3600 max_input_vars : 200000 memory_limit : 2G

then go to your MySQL database

find core_config_data table

change base URL localhost to 127.0.0.1

than search path Like %...% domain then Go

change value localhost to 127.0.0.1 in front of web/cookie/cookie_domain ( path )

Go to your magento root directory then app -> /etc/ -> env.php open this file change value localhost to 127.0.0.1 ( 2 places in file )

go to browser press ctrl+shift+delete then check cache || cookie click on clear data

then run all command with sudo on magento root directory

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento indexer:reindex

php bin/magento cache:clean

php bin/magento cache:flush
Share:
48,130
rodge
Author by

rodge

Updated on February 24, 2021

Comments

  • rodge
    rodge about 3 years

    I have a weird situation again that I have encountered on Magento. A few hours ago, I successfully logged in to admin dashboard. After I logged out and restart my pc and tried to log in again. I got an error

    Invalid Form Key. Please refresh the page.

    Magento was installed on a live server. I didn't change anything or add something to the database. Credentials are valid but we cannot log in. Also, I cannot login to the Magento downloader panel.

    What kind of bug is this?

    How can we solve this?

    UPDATE!

    From @DouglasRadburn link. The detailed explanation of the problem and the possible solutions.

    https://magento.stackexchange.com/questions/98220/security-patch-supee-7405-possible-problems/98236#98236

    Also similar to @Makwana Ketan answer