3

I've started out with Magento 2. Everything's working fine, except for Magento's formKeyValidator which isn't able to validate the incoming request. It's happening on the frontend.

While adding a product to the cart or creating an account. This isn't passing::

// module-checkout/Controller/Cart/Add.php - function execute()
$this->_formKeyValidator->validate($this->getRequest())

I've increased the cookie lifetime, set the valid domain, and path ( http://localhost/mysite, domain:localhost, path:/mysite ) from the backend config panel, yet for some reason I keep getting this:

"Your session has expired"

16

Yes, use 127.0.0.1 instead of localhost.

UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/magento/' WHERE `core_config_data`.`path` = 'web/secure/base_url';
| improve this answer | |
  • Thanks. I actually solved it the same day when I fist posted it. This answer might help others. – keaton016 Jan 29 '19 at 16:27
  • I tried but not working. – sarvesh Dineshkumar Patel Jul 16 '19 at 11:22
  • Thanks @jean works for me – Nagaraju K Sep 3 at 11:45
5

Step 1: Disable the cache
Steps 2: Run below two lines of Mysql code

UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/yourmagentofolder/' WHERE `core_config_data`.`path` = 'web/unsecure/base_url';
UPDATE `core_config_data` SET `value` = 'http://127.0.0.1/yourmagentofolder/' WHERE `core_config_data`.`path` = 'web/secure/base_url';
| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.