How to Solve Invalid Token Error with Joomla
Have you ever experienced the "Invalid Token" error while looking at a Joomla built website?
Well if you have, read on. I've seen two different sources of this error:
- System cache
- Issue with a field validation form
It seems that when users try to log in when they are already logged in you may get an Invalid Token error. Check that your Joomla "System-Cache" plug-in has "Use Browser Caching" set to No.
The other issue is with extensions. It has happened twice to me now that after using an extension that has some form field validation I get "Invalid Token" errors.
Typical Invalid Token messages come from prevention of Cross Site Request Forgery (CSRF). Details of CSRF and the use in Joomla can be found here.
In both of my instances I was able to find the form that was the culprit. It was just a matter of finding the code and making sure it I added this just before closing the form tag:
<?php echo JHTML::_( 'form.token' ); ?>
I'd like to think this is a rare thing to find but in both of my cases it was found in well known Joomla extensions. I've since reported the issue with those extension providers and it's been fixed, but this will undoubtedly keep coming up for others.
Hopefully this saves you some of the headache.