Magento 2.x Invalid Form Key. Please refresh the page

There are following below cases where you are getting this error “Invalid Form Key. Please refresh the page”

  • When customer creating new Account
  • When customer Login in existing account
  • When customer trying to Change / Forget Password
  • When customer adding product in Cart
  • When Store Login Login Admin side
  • When creating a configurable product with multiple attributes
  • When customer trying to add product to wishlist
  • Even with a fresh Magento 2 installation
  • After upgrading Magento 2 version
  • Installing a new Magento 2 theme/module

Solution:: Need to increase the value of PHP Max_input_vars to the value in php.ini (PHP Configuration File)

The recommended value for Max_input_vars for Magento 2 should be 100000

After that restart Web Server (Apache / Nginx) to apply changes.

Finally issue will be resolved.

Leave a Reply

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