Hello Magento Folks,
In this tutorial, I am going to provide the solution for the most common error in Magento 2, “Invalid Form Key. Please refresh the page”.
Everyone might have encountered an Invalid form key error while working with Magento admin. Today I am here to resolve this error in two ways. Before that, first, let’s understand the reasons behind the error.
Contents
The following actions may be the cause for “Invalid Form Key. Please refresh the page” error:
There are two main reasons that generate “Invalid Form Key. Please refresh the page” error.
PHP Max_input_vars is the maximum number of attributes that your server can use for a function. The default value is 1000 which is not enough for Magento 2. This causes the invalid form key error.
If you encounter an invalid form key error on localhost, it is probably because you will be using localhost as the base URL for your website instead of 127.0.0.1
There are 2 ways to fix “Invalid Form Key. Please refresh the page” error in Magento 2
Go to path – /etc/php/7.3/apache2
Now, open your terminal and run the below command
gedit php.ini
Change max_input_vars to 5000 as shown in the below image.
Please check the updated value by phpinfo file.
Run the below command to get rid of the invalid form key error
php bin/magento setup:store-config:set --base-url="http://127.0.0.1:8080/"
Or else you can follow the below steps,
Try the above solutions to get rid of the “Invalid Form Key. Please refresh the page” error in Magento 2. If the error still persists, you can take the help of our Support Team which will guide you to solve the invalid form key error.
Spread the article amongst your friends to help them resolve the error.
Happy Reading!
In modern web development, seamless navigation and state management are crucial for delivering a smooth…
Magento Open Source 2.4.8 beta version released on October 8, 2024. The latest release of…
Hello Magento Friends, Creating catalog price rules programmatically in Magento 2 can be a valuable…
As the world of eCommerce continues to thrive, Shopify has become one of the most…
Shopify Remix is an innovative framework that provides a streamlined experience for building fast, dynamic,…
Building a successful eCommerce store requires expertise, and for many businesses, Shopify has become the…
View Comments
The first option was useless because my limit was already high. The second option broke my login page.