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!
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…
Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…
Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…
We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…
Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…
View Comments
The first option was useless because my limit was already high. The second option broke my login page.