Saturday, March 15, 2008

HOWTO: Fix "Invalid Token" issue in Joomla

This morning i tried to log in into Admin's Section, and i get the following error:

"INVALID TOKEN"

This error is related to cookies. It happened when we changed our summer time (Net-Recon Argentina Team went back one hour) - at that time, my account was blocked.

First off, if you get this error, all you have to do is to delete your cookies (This will let you log in into your admin section).

Then you have to search for this line in your login form:


<input type="hidden" name="<?php echo JUtility::getToken(); ?>" value="1" />


And change it to:


<input type="hidden" name="<?php echo JHTML::_( 'form.token' ); ?>" value="1" />



This will fix the issue.


These kind of issues are very common if you use Joomla v1.0 templates in Joomla v1.5.


-Nico.
Net-Recon
Web Design and Flash Games - Based in Austin, TX

12 comments:

ZaZa said...

Wish it worked and was the real problem!
I just built the site today using the latest 1.5.2 in which the code is fixed and I still get the invalid token :'(

Nico Di Fiore said...

Hi Zaza,

Try to delete your cookies/cache from IE. So Correct the code + delete your cookies/cache... and now it should be working...

Thanks.
Nico.

modabrecho said...

nice tip

Tdako said...

Hi Nico,

I've been getting this Invalid Token error a few times using joomla 1.5.14 and the ja_edenite template. When I use another template, like ja_purity that came with the joomla installation, everything looks fine.

Anyways, I found the file default.php in the mod_login folder and made the changes you mention above. There are two lines for this, right?

But now, on the home page where the login form and buttons are, I have " value="1" /> right after the Login button.

Can I remove this somewhere?

Kind Regards and thanks in advance
Teddy

john said...

I am suffering from this problem from a long time and finally i get the solution through this post.
So i want to say thanks to this post owner.
-Dallas web design

Irfan Memon said...

glade to visit ur blog web design perth

Rayrobi said...

hello all,

i just deleted the browsers cookies/cache, replaced the code, but still get the invalid token error. Do anyone have an idea how to fix this?

ayesha said...

thanks for such a nice post
website design company

Web Design Company In UK said...

Good post

flourence said...

Keep up the Good work...
website design perth

website builers perth said...

Try to delete your cookies/cache from IE. So Correct the code + delete your cookies/cache... and now it should be working...Website Design Perth

Augusta Tina said...

This is one of the most incredible blogs I have read in a very long time. Your blog is great for anyone who wants to understand this subject more. Great stuff.Cheap Logo Design