- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Magento 2.3.5: Showing Invalid Form key on every page
Hi,
We are facing an issue after upgrading Magento version to 2.3.5.
Invalid form key. Please refresh the page. is showing on every page only on safari browser.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
Hi @mandar_parbate1
If this issue is only coming on Safari browser try clearing all the cache on the browser and check again.
Also can you confirm from which version of magento 2 you have done upgrade to magento 2.3.5?
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
im using 2.3.5-p1. facing same error.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
Hi
Facing the same issue here.
Invalid Form Key. Please refresh the page.
Magento ver. 2.3.5-p1
Safari only.
I've changed to developer mode.
Cleaned all directories with
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
CSP is not setup correctly. Either fix csp or disable it:
php bin/magento module:disable Magento_Csp
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
I try to disable this module using your command.
It says:
-bash: magento: command not found
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Magento 2.3.5: Showing Invalid Form key on every page
In my case, this was caused by a typo in a template file.
In my theme's template, Magento_Review/templates/review.phtml:
<script type="text/x-magento-init"> { "*": { "Magento_Review/js/process-reviews": { "productReviewUrl": <?= $block->escapeJs($block->getProductReviewUrl()) ?>", "reviewsTabSelector": "#tab-label-reviews" } } } </script>
There's a missing double quote, and it should look like this:
<script type="text/x-magento-init"> { "*": { "Magento_Review/js/process-reviews": { "productReviewUrl": "<?= $block->escapeJs($block->getProductReviewUrl()) ?>", "reviewsTabSelector": "#tab-label-reviews" } } } </script>
After adding that double quote, the JS for Add to Cart populates with the correct Form Key, and all is good.