{"id":15784,"date":"2012-03-14T06:58:04","date_gmt":"2012-03-14T10:58:04","guid":{"rendered":"http:\/\/www.templatemonster.com\/help\/?p=15784"},"modified":"2017-08-16T10:59:33","modified_gmt":"2017-08-16T14:59:33","slug":"joomla-troubleshooter-ivalid-token-error","status":"publish","type":"post","link":"https:\/\/www.templatemonster.com\/help\/joomla-troubleshooter-ivalid-token-error.html","title":{"rendered":"Joomla Troubleshooter. Invalid Token error"},"content":{"rendered":"<p>\r\n<p>Working with Joomla website you can see the Invalid Token error message. In this post we&#8217;ll describe the error and offer some way of solving it.<\/p>\r\n<h4>What are Tokens anyway ?<\/h4>\r\n<p>Tokens first made their way into Joomla with Joomla 1.5.3. They were introduced as a security feature for forms. For any form submitted on a Joomla website, a token was expected to be passed. If this was incorrect or missing, you&#8217;d get an Invalid Token error. This is really good as it thwarts Spam &amp; hack attempts.<\/p>\r\n<h4>What&#8217;s affected ?<\/h4>\r\n<p>All forms in Joomla are affected by this. This error was more noticeable in the Login &amp; Registration forms as these are the most used. <\/p>\r\n<h4>Why are we getting Invalid Token Errors ?<\/h4>\r\n<p> There are many reasons for you to get this error, and here\u2019s a list of the most common ones: <\/p>\r\n<p> <strong>Expired cookie:<\/strong>\u00a0The cookie that Joomla expects you to have has expired. Deleting your cookies and trying to login again will fix the problem. <\/p>\r\n<p><strong>Caching:<\/strong><\/p>\r\n<ol>\r\n<li>Disable caching entirely. This is a two step process:\r\n<ol type=\"a\">\r\n<li>Login to your Joomla control panel, go to\u00a0<em>Site<\/em>,\u00a0<em>Global Configuration<\/em>,\u00a0<em>System<\/em>, and click on &ldquo;No&rdquo; next to\u00a0<em>Cache<\/em>\u00a0under Cache<em> Settings<\/em>\u00a0and<\/li>\r\n<li>Disable the System cache plugin, by going to\u00a0<em>Extensions<\/em>,<em>Plugins<\/em>, and then search for the\u00a0<em>System \u2013 Cache<\/em>\u00a0and click the checkbox next to it, and finally click on\u00a0<em>Disable<\/em>\u00a0on the top right.<\/li>\r\n<\/ol>\r\n<\/li>\r\n<li>Fix the code for the login (or the other feature you&rsquo;re having problem with) yourself, by commenting out the check for the token.<\/li>\r\n<\/ol>\r\n<p>In form file locate the following code:<\/p>\r\n<pre class=\"brush:php\">  &lt;input type=\"hidden\" name=\"&lt;?php echo JUtility::getToken(); ?&gt;\" value=\"1\" \/&gt;  <\/pre>\r\n<p>and replace it with <\/p>\r\n<pre class=\"brush:php\">   &lt;?php echo JHTML::_( 'form.token' ); ?&gt;  <\/pre>\r\n<p> <strong>Using legacy mode (Joomla 1.0 mode)<\/strong>: Using Joomla in Legacy mode is known to cause this problem. Just disable the legacy mode plugin. <\/p>\r\n<p><strong>Using legacy code for checking for tokens<\/strong>: Some versions of Joomla\/Joomla templates feature some legacy code to check for tokens. This code needs to be changed. Here\u2019s how to fix this problem:<\/p>\r\n<ul>\r\n<li>Open up the file<strong>\u00a0<em>\/modules\/mod_login\/tmpl\/default.php<\/em><\/strong>\u00a0and change the line\u00a0<strong>&lt;?php JUtility::getToken(); ?&gt;<\/strong>\u00a0to<strong>\u00a0&lt;?php echo JHTML::_( &#8216;form.token&#8217; ); ?&gt;<\/strong><\/li>\r\n<li>In many cases, the login module is overridden by the template, so you need to check the code in your template there to see if it\u2019s using the\u00a0<strong>JUtility::getToken();<\/strong>\u00a0and change it to the\u00a0<strong>JHTML::_( &#8216;form.token&#8217; );<\/strong><\/li>\r\n<\/ul>\r\n<p> <strong>Disabled cookies on browser<\/strong>: If cookies are disabled on your browser then you will definitely see this problem. Enabling cookies will fix it. <\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<p><\/p>\r\n<div class=\"inline-banner\">\r\n<a href=\"https:\/\/www.templatemonster.com\/cart.php?addOffer=587\">\r\n<img src=\"\/help\/files\/banners\/inline\/Banner-1-(500-x100).jpg\" \/>\r\n<\/a>\r\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Working with Joomla website you can see the Invalid Token error message. In this post we&#8217;ll describe the error and offer some way of solving it.<\/p>\n","protected":false},"author":2,"featured_media":15866,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[724],"tags":[483,1161],"_links":{"self":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/15784"}],"collection":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/comments?post=15784"}],"version-history":[{"count":1,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/15784\/revisions"}],"predecessor-version":[{"id":82794,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/posts\/15784\/revisions\/82794"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media\/15866"}],"wp:attachment":[{"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/media?parent=15784"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/categories?post=15784"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.templatemonster.com\/help\/wp-json\/wp\/v2\/tags?post=15784"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}