invalid token during logging in

Everything to do with Joomla! 1.5 templates and templating.

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
prilly
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 198
Joined: Thu Feb 26, 2009 11:09 am

Re: invalid token during logging in

Postby prilly » Fri Dec 04, 2009 12:19 am

Well, I was having weird problems with an installation today and discovered that one of the directories, the plugins folder, was not writable.

I don't know if that would have something to do with your problems but you might want to make sure the Joomla installation is all completed (just in case that's the problem.)

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Fri Dec 04, 2009 12:36 am

Hmm, I'll have to check, but everything was working fine previously, then I hadn't used it for a week then all of a sudden I keep getting kicked out and receiving invalid token messages.

pagemagnify
Joomla! Apprentice
Joomla! Apprentice
Posts: 7
Joined: Wed Dec 09, 2009 5:17 pm
Contact:

Re: invalid token during logging in

Postby pagemagnify » Wed Dec 09, 2009 5:23 pm

inthis case i used safari and its working fine.
Signature rules: Literal URLs only - viewtopic.php?f=8&t=65

rosspet
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Dec 23, 2009 12:25 pm

Re: invalid token during logging in

Postby rosspet » Wed Dec 23, 2009 12:42 pm

Hi

I also started getting the dreaded "Invalid Token" after I installed "cms-realty", however the combination of it and joomla is so good I want to stay with them, so, after reading the hundreds of posts about this error, I decided to just comment out the code "JRequest::checkToken() or jexit( 'Invalid Token' );" in " function login()
{
// Check for request forgeries
JRequest::checkToken() or jexit( 'Invalid Token' );

(line 60 in component/com_user/controller.php).

The error has gone and the login module still seems to block unregistered members (for the moment).

I expect someone from the team will tell me I've probably compromised my site, but I'm really hacked off with the fact that this problem has been going on for so long with no apparent solution.

PS - I do appreciate all the effort the Joomla team has put in to providing a straightforward and excellent CMS for free.

UPDATE:- It's B***** back!!!! Ah well, back to the drawing board.

rosspet
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Dec 23, 2009 12:25 pm

Re: invalid token during logging in

Postby rosspet » Mon Dec 28, 2009 12:22 pm

I've given up!, read everything, tried everything, nothing seems to work (well some of it does, but the error just keeps creeping back. So it's bin joomla and run OR on it's own - pity.

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 676
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: invalid token during logging in

Postby mojito » Mon Dec 28, 2009 2:17 pm

I have issues with this as well, I tried deleting cookies and cache to no avail, doenst always afflict everyone, would be helpful to know what is behind things with this error.
Check out the 'bad toilet' online !

spider2009
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Wed Oct 21, 2009 3:05 pm

Re: invalid token during logging in

Postby spider2009 » Sun Jan 17, 2010 9:33 pm

I'm having the same problem too. The problem goes away once I add my Joomla! site the list of the trusted web sites. But, like it was mentioned in this thread away back, this is not a solution. You cannot ask each of your members to add your web site to the list of the trusted web sites in order to login.

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 676
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: invalid token during logging in

Postby mojito » Sun Jan 17, 2010 9:53 pm

I hope this is something they fix in 1.6 its really a horrible error and there must be a better way or work around to ensure this isnt occuring.
Check out the 'bad toilet' online !

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Sun Jan 17, 2010 10:41 pm

I still get the problem. Could it be server related? I logged into a previous site I built 6 months ago which the clients hosted themselves and there doesn't appear to have a problem. I'm sure nothing has been changed in the way I am building the sites so I can't think of anything else that would cause it?

Both were hosted with namesco, but all sites that I try on our hosting have this problem...

User avatar
mojito
Joomla! Guru
Joomla! Guru
Posts: 676
Joined: Wed Sep 07, 2005 10:18 pm
Location: London
Contact:

Re: invalid token during logging in

Postby mojito » Sun Jan 17, 2010 10:59 pm

Deep in the rocket science lab it has been hear that


"come on guys its not server technology ...." :)
Check out the 'bad toilet' online !

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Mon Jan 18, 2010 7:42 am

I don't think anyone knows what the problem is otherwise we wouldn't still be having the problem!

All I know is that I'm working with a CMS that don't work! I think I may have to turn to other alternatives as it doesn't look like anyone's going to address this issue or even acknowledge it's there!

User avatar
OOmNezar
Joomla! Ace
Joomla! Ace
Posts: 1870
Joined: Mon Sep 07, 2009 3:18 am

Re: invalid token during logging in

Postby OOmNezar » Mon Jan 18, 2010 8:01 am

HIII.........
This is to all...........
Before installed Joomla at Webhost, please installed Joomla at localhost.
This way to compare between webhost as server and localhost as server.
Are your problem are same in webhost or localhost.
I think the problem are in the cache doesn't received by host, or because of timeout on server.
coffee & smoke just fine

OOm Nezar

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Mon Jan 18, 2010 9:03 am

Site work's perfectly on localhost, it's just when it's uploaded.

rosspet
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Wed Dec 23, 2009 12:25 pm

Re: invalid token during logging in

Postby rosspet » Mon Jan 18, 2010 10:23 am

It appears with me both with localhost and when uploaded. I tried uploading a clean install and a separate installation using my webhost's "fantastico de luxe" - error still appeared.

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Thu Feb 04, 2010 11:48 am

We are having this error aswell.

We also get the error when someone signs up (registers)

It is intermittent, sometimes it happens sometimes not. I thought it was because of a time out because we have alot of information on the same page as the registration form which we have in a module.

But that does not appear to be the case as today one of our sales team went to pitch to a client, started their laptop, opened Firefox 3.5, went to the site, filled in the form and got the 'Invalid Token' error.

AT THE VERY LEAST CANT THIS ERROR DO SOMETHING MORE USEFUL?- like refresh/redirect to the page the user was on and display a 'try again- invalid token' message. Just showing a blank screen with 'Invalid Token' that wont go away no matter how many times you refresh just cost us a $500 deal- if it did a redirect/refresh they could still try again and it would probably be ok.

Any guidance on this would be urgently and massively appreciated- we cant afford to loose money like that because of this error/functionality!

Cheers

D

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Thu Feb 04, 2010 12:18 pm

maxmedia wrote:Maybe I found a verry dirty hack.

In component/com_user/controller.php:

We can replace:

Code: Select all

   
        function login()
   {
      // Check for request forgeries
                JRequest::checkToken() or jexit( 'Invalid Token' );


All i want is to get rid of the broken Invalid Token error and return the users to the index page.
Can we replace jexit with something as return?

I did this, but gives me a php error:

Code: Select all

   
        function login()
   {
      // Check for request forgeries
                JRequest::checkToken() or {
         JError::raiseError( 200, JText::_('Invalid Token') );
         return;
      }


Did anyone get this to work? It seems like a great and simple patch to this problem. (a problem that just lost us a $500 deal btw)

I think what needs to happen to enable people to actually login/submit/register after they have seen this damn 'Invalid Token' thing is that a) the code needs to redirect them to the page they were on and b) refresh that page to make sure they get a new token.

It would not be an idea fix as this shouldn't happen at all but at least it would avert the usability catastrophie that is the 'blank 'Invalid Token' page' which frankly just makes us all look like idiots who don't have a clue what we are doing!

If anyone has made this work PLEASE post what code to replace and where

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Fri Feb 05, 2010 12:23 am

I've managed to find the route of my problem with this...

In testing the site live. I uploaded the site into a folder within an existing site. eg. www.domain.co.uk/newjoomlasite. It was under these conditions I was having the invalid token problem.

When I set up the new domain name correctly (www.newjoomlasite.com) I received an error that the page had invalid or out of date certificate. I then viewed the certificate and made an exception for the page and voila no more getting kicked out of the admin followed by invalid token messages.

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Fri Feb 05, 2010 1:34 am

Hey there could you be a bit more specific/descriptive about what you did please?

i.e. what do you mean here:-
I then viewed the certificate and made an exception for the page


what certificate, how do you view it, how/where do you make the exception etc etc

a13wes
Joomla! Apprentice
Joomla! Apprentice
Posts: 10
Joined: Tue Sep 15, 2009 2:18 pm

Re: invalid token during logging in

Postby a13wes » Fri Feb 05, 2010 10:20 am

Apologies.

It's the security certificate of the web page. It depend on what browser you're using as to how you locate it. I'm on a mac and it's not as easily found. Which is why I never realised it was the route of the problem until I set the domain up correctly. Then It appeared as a pop up. Other than that on a mac I think the info is stored in the keychain.

You will have to check how you find it for your set browser. I'd recommend searching google. It's usually in preferences, security or something like that...

Hopefully someone here can elaborate more on security certificates as my knowledge is sparse on the subject!

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Fri Feb 05, 2010 11:47 am

Not sure this is relevant to us as we dont currently use an ssl.

Does anyone know why it is that the 'Invalid Token' message does not show up like other joomla messages i.e. in the $msg on the actual page?

This would make the world of difference as users getting this 'error' would not feel like they had collapsed the site etc. As far as I can tell this is the only Joomla message that works this way. Why is that? Can't something be done about it?

jobromedia
Joomla! Apprentice
Joomla! Apprentice
Posts: 5
Joined: Thu Oct 15, 2009 5:06 pm

Re: invalid token during logging in

Postby jobromedia » Sat Feb 13, 2010 3:07 am

I've had this problem, and I found out that this was caused by letting the database handle your sessions. Long story short:

Global configuration > System > Session settings > Session handler = None.

This way the users browser takes control over their own sessions, and removing the stress from the database.

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Sat Feb 13, 2010 5:06 pm

Wierdly, turning the session handler to none seems to stop the front end from loading at all- I just get 'waiting' in the browser.

Would have been nice if it was that easy... :(

ralfeez
Joomla! Apprentice
Joomla! Apprentice
Posts: 46
Joined: Thu Jan 17, 2008 10:25 pm
Location: California
Contact:

Re: invalid token during logging in

Postby ralfeez » Mon Feb 15, 2010 5:25 pm

Oh come on team! This is a pretty major bug. Is there some work around? I just need it to work so that the client stops screaming. I don't really care how it is done in the code. Just let me know and I will make the patch. This has been going on for quite some time. Please please please please.....
thanks,
Ralph

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Mon Feb 15, 2010 8:42 pm

I am not sure if this is of any help to any one since our set up is a bit unusual as we have the registration form showing in a module and the login form (from YooTheme whose support is diabolical by the way) appearing as a menu dropdown on the same page (i.e. you do not go to another page to register. You also get logged in automatically when you register.

Anyway what I discovered in our scenario is the following:-
<?php echo JHTML::_( 'form.token' ); ?> sometimes outputs different tokens to the login and registration forms. In our case the login form seems to always have the right one i.e. over loads of tests I discovered that if the tokens differed I could login without an 'Invalid Token' error but could not register.

I am talking to Mighty Extensions (who have very good support by the way) to see if there is anything they can do to make the registration form echo the 'right' token but no results there yet.

How I have solved the issue temporarily:-

Change <?php echo JHTML::_( 'form.token' ); ?> in the login form template to:-
<?php $formtoken = JHTML::_( 'form.token' );
$formtoken =str_replace('<input type="hidden"' , '<input type="hidden" id="loginformtoken"' , $formtoken);
echo $formtoken;
?>

Change <?php echo JHTML::_( 'form.token' ); ?> in the registration form to:-
<?php $formtoken = JHTML::_( 'form.token' );
$formtoken = str_replace('<input type="hidden"' , '<input type="hidden" id="regformtoken"' , $formtoken);
echo $formtoken; ?>

By doing that the form tokens now have an individual id. In our case I could now use Javascript to change the Registration form token to match the login form token:-
<script language="javascript" type="text/javascript">
window.addEvent("domready", function(){
var logintoken = document.getElementById('loginformtoken').name;
var regtoken = document.getElementById('regformtoken').name;
if (logintoken != regtoken) {
document.getElementById('regformtoken').name = logintoken;
}
});
</script>

Obviously this script takes advantage of MooTools domready function so you'll need it enabled in Joomla for it to work (it will be unless you have done something to turn it off i believe)

As I say our setup is unusual but i hope my discoveries/temp solution are of help to someone.

D

User avatar
Agence Elysium
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 19, 2010 4:32 pm
Location: Montréal, Québec, Canada
Contact:

Re: invalid token during logging in

Postby Agence Elysium » Fri Feb 19, 2010 5:07 pm

Some solutions might work for some and not for others, it depends on alot of factors.

Here's how I solved it in my case.

There is a major bug causing all kinds of errors on some hosting services I personaly consider as not good enough for professional web developement (GoDaddy). It's due to the "if( vmIsJoomla( '1.5' ) ) {...} else {...}" argument you'll find in alot of modules and components, including Virtuemart. So, if using Joomla 1.5, you don't need those and you can just comment them out. So in the end, you'll just keep what's inside "if( vmIsJoomla( '1.5' ) ) {...}".

In the case of the Virtuemart Invalid Token error on checkout, remove them all from these files:

components/com_virtuemart/html/checkout_register_form.php
components/com_virtuemart/html/checkout.login_form.php

As for the Virtuemart login module, it's the same principle.

Bottom line I think is to choose your hosting company well before developing an eCommerce site.

Thanks.
Last edited by Agence Elysium on Fri Feb 19, 2010 5:37 pm, edited 1 time in total.

User avatar
Agence Elysium
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 19, 2010 4:32 pm
Location: Montréal, Québec, Canada
Contact:

Re: invalid token during logging in

Postby Agence Elysium » Fri Feb 19, 2010 5:32 pm

Agence Elysium wrote:Some solutions might work for some and not for others, it depends on alot of factors.

Here's how I solved it in my case.

There is a major bug causing all kinds of errors on some hosting services I personaly consider as not good enough for professional web developement (GoDaddy). It's due to the "if( vmIsJoomla( '1.5' ) ) {...} else {...}" argument you'll find in alot of modules and components, including Virtuemart. So, if using Joomla 1.5, you don't need those and you can just comment them out. So in the end, you'll just keep what's inside "if( vmIsJoomla( '1.5' ) ) {...}".

In the case of the Virtuemart Invalid Token error on checkout, remove them all from these files:

components/com_virtuemart/html/checkout_register_form.php
components/com_virtuemart/html/checkout.login_form.php

As for the Virtuemart login module, it's the same principle.

Bottom line I think is to choose your hosting company well before developing an eCommerce site.

Thanks.



Since this is a general "Invalid Token" problem topic, it also worked on the Joomla login module and other components and modules as I said.

Thanks.

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Sat Feb 20, 2010 3:43 pm

How do you know/how can one tell if it is an issue with your hosting provider? What tests can I run to prove this is the case? I am with a small (but well regarded company) in the UK 5Quidhost who would I am sure make any adjustments we need if it their hosting/set up that is causing the problem. Obviously we would have to demonstrate to them that it is their fault and not the fault of any of our components, modules or configuraation.

pdebnath20
Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Thu Feb 04, 2010 10:18 am

Re: invalid token during logging in

Postby pdebnath20 » Sat Feb 20, 2010 3:44 pm

Hi! what is java?

davidosullivan
Joomla! Intern
Joomla! Intern
Posts: 78
Joined: Sat Dec 02, 2006 4:54 pm

Re: invalid token during logging in

Postby davidosullivan » Sat Feb 20, 2010 4:18 pm

Hey, if you are revering to my post, I was talking about Javascript, not Java, the two are different. Javascript is a script language like html, php etc but the special thing about Javascript is that it can run in the persons browser in response to what the user does or the page finishing loading and other such events. This is the opposite to PHP which is a server side script which runs before/during the construction of the html page.

User avatar
Agence Elysium
Joomla! Fledgling
Joomla! Fledgling
Posts: 3
Joined: Fri Feb 19, 2010 4:32 pm
Location: Montréal, Québec, Canada
Contact:

Re: invalid token during logging in

Postby Agence Elysium » Sat Feb 20, 2010 9:29 pm

@davidosullivan, you are right I should do more extensive tests to claim that.
As I said there are many reasons to the "Invalid Token" problem, leading to different solutions. My case was that I was getting multiple SQL errors with GoDaddy along with the "Invalid Token" one, and when I made the changes, all gone. While it never happened on the hosting I usualy use.

Someone pointed out that there's also a problem with Joomla! 1.0 templates that can cause the "Invalid Token" problem too, and I think that's also the problem in my case.

I'm just not sure how all this is related and I don't feel like doing serious PHP/SQL troubleshooting to know the exact cause. I need solutions and you should just try them all to find yours.

Thanks.


Return to “Templates for Joomla! 1.5”

Who is online

Users browsing this forum: No registered users and 4 guests