cancel
Showing results for 
Search instead for 
Did you mean: 

Invalid Form Key. Please refresh the page.

Invalid Form Key. Please refresh the page.

I am stuck!

 

I am trying to install a theme (Codazon FASTEST) and as soon as those files get into my installation I have problems on the admin area. Let me try to explain: 

 

I was getting a 500 error on images when I finished installing the theme. 

I noticed that the files AND folders on the installation files have permission 775. So I changed the permission of the files to 644 and folders to 755 and everything looks fine with the exception that when I clear the caches and try to login to the admin of the store I get a:

Invalid Form Key. Please refresh the page.

When I try the password AGAIN I get in, but as soon as I click on something I get kicked out to the login screen again.

I also tried to modify the php.ini, the .htaccess ... and the problem is still there.

I am running out of options. Any suggestions? Thank you in advance!

10 REPLIES

Re: Invalid Form Key. Please refresh the page.

Hi @fabio_alves1

 

okay i understand - can you please check max_input_vars value of your server 's php.ini file ?

 

it should be at least - max_input_vars = 100000

 

Try this and let me know if its work for your or not !!

 

 

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Invalid Form Key. Please refresh the page.

Hey! Thanks for the message. 

 

On my root installation folder I have a php.ini.sample

 

I changed the  max_input_vars = 100000 and renamed it to php.ini 

 

Same problem. 

Re: Invalid Form Key. Please refresh the page.

Hi @fabio_alves1

 

can you remove generate directory and then remove var/cache and var/page_cache directory !

 

Then run below commands :

 

php bin/magento cache:clean

 

php bin/magento cache:flush

 

 

Another option would be - just open yourdomain.com/admin_prefix - i mean admin url only no formkey appended to it first - open that url and then try !

 

Also don't bookmark admin URLs with formkeys or leave them open in a tab. It can bring the issue back. Always bookmark the clean Admin panel URL and use that.

if issue solved,Click Kudos & Accept as Solution

Re: Invalid Form Key. Please refresh the page.

Renamed generated directory to _generated

deleted /var/cache and /var/page_cache

ran both cache commands on my server 

opened a private browser window

used the yourdomain.com/admin_prefix (without the Key) 

 

and the problem persisted. I immediately get a "Invalid Form Key. Please refresh the page."  that does let me in the second time and kicks me out as soon as I press any button on the admin page. 

Re: Invalid Form Key. Please refresh the page.

Hi @fabio_alves1

 

strange !! are you using any cache mechanism on it ? - like Redis cache or Varnish cache or mamcache  ?

if issue solved,Click Kudos & Accept as Solution

Re: Invalid Form Key. Please refresh the page.

@ManthanDave unless it's in my server and I am not aware of it, NO I am not. 

 

(I know ... it's so strange, I have been dealing with this since yesterday)

Re: Invalid Form Key. Please refresh the page.

New information: 

 

I noticed that if I wait a while I can get back in the store and make changes. 

 

So as long as I don't clear the caches I should be ok. I also noticed that when I try to change something on the ADMIN part of the store I an error saying that something went wrong and I should look at the log, It also says that magento couldn't write to the logs and I should use the developer mode. 

 

If I REFRESH the screen, my change get accepted! O.O 

Re: Invalid Form Key. Please refresh the page.

Hi @fabio_alves1

 

okay - i understand , so now what error log says ? is there still any error on this or its resolved ?

 

 

if issue solved,Click Kudos & Accept as Solution

Re: Invalid Form Key. Please refresh the page.

@ManthanDave which log file I should look at? I can post it here.