Magento2 Customer login Invalid request received

enter image description here

When i try Register customer, i receive similar kind of error.

"Magento\Customer\Controller\Account\CreatePost\Interceptor" {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0): Invalid request received at /var/www/html/airbnb/app/code/Magento/Customer/Controller/Account/CreatePost.php:327)"} []

On Login page i receive this error as shoon in screen shot too.

Request validation failed for action "Magento\Customer\Controller\Account\LoginPost\Interceptor" {"exception":"[object] (Magento\\Framework\\App\\Request\\InvalidRequestException(code: 0): Invalid request received at /var/www/html/airbnb/app/code/Magento/Customer/Controller/Account/LoginPost.php:158)"} []

Last time register have worked when i changed the permission of Generated folder to 777

enter image description here

when i run Xdebug, and submit customer login form, i see this error. enter image description here

  • Change the permission to var folder to 777.
    – smruti
    Commented Nov 1, 2021 at 13:45
  • sudo chmod 777 airbnb/var I run this command but still same error. Commented Nov 1, 2021 at 13:54
  • Have you created that third party extension for any customization and overide that things into that one? Commented Nov 1, 2021 at 14:00
  • run this command - sudo chmod 777 -R var/ that means set 777 to all folder under var folder
    – smruti
    Commented Nov 1, 2021 at 14:01
  • Can you please share your controller code Commented Nov 2, 2021 at 9:54

2 Answers 2


Invalid Form Key. Please refresh the page

This is the error. Magento has a Form Key to tackle spamming issues.

It looks like your form Key has expired. Just check the Age of Form Key.

  • where i can check formkey age? in which file or table? Commented Nov 2, 2021 at 4:08
  • php_value session.gc_maxlifetime 86400 this values are internally used by cookies and form keys Commented Nov 2, 2021 at 16:08

The problem was with my local vertualhost name. Name should be in 2 parts, seperated by a Dot(.) I was running it like http://stayingspacelocal/ somebody in stackoverflow told that it should be split by Dot. Dot is necessary otherwise that problem will occure. Than i changed my local vertual host to http://stayingspace.local/ and the issue is fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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