"Invalid CAPTCHA token" on user registration form

marcus0263 - April 12, 2008 - 04:41
Project:CAPTCHA
Version:6.x-1.0-rc2
Component:Captcha API (captcha)
Category:support request
Priority:normal
Assigned:soxofaan
Status:active (needs more info)
Description

Since upgrading to Drupal 6.2 Captcha is seriously broke. When ever attempting to register new user this error keeps coming up. I've uninstalled, removed and reinstalled Captcha with no success.

#1

soxofaan - April 12, 2008 - 10:54
Title:Invalid CAPTCHA token.» "Invalid CAPTCHA token" on user registration form
Status:active» active (needs more info)

I can't reproduce this with Drupal 6.2 and CAPTCHA 6.x-1.0-rc2

If I understand you correctly:
You had first a Drupal 6.1 installation with CAPTCHA 6.x-1.0-rc1 and CAPTCHA on user registration worked as desired.
You upgraded to Drupal 6.2 and CAPTCHA 6.x-1.0-rc2 and CAPTCHA on user registration stopped working?

Is this correct (especially that it worked before the upgrade)?

Does CAPTCHA 6.x-1.0-rc2 work on other things like the comment forms?
Please check for both anonymous as authenticated users (without skip CAPTCHA permission of course).

#2

marcus0263 - April 12, 2008 - 15:49

Yes everything was working fine before the upgrade to Drupal 6.2 with Drupal 6.1.

I restrict anonymous access and the only Captcha I have active is for new user registration.

I'll test tonight more thoroughly and post the results

Cheers

#3

vortechs - April 16, 2008 - 21:10

I am also having this issue with Drupal 6.2 and 6.x-1.0-rc2 of CAPTCHA. I did not however, have CAPTCHA installed in drupal 6.1 - the last time I had it installed was Drupal 4.7 before I upgraded to 5.7, then 6.1, then 6.2 last week, and I removed the module when I upgraded to 5.7, and didn't reinstall it until after I upgraded to 6.2.

This appears to be something in the CAPTCHA core, since it shows up when using text captchas or the recaptcha module.

#4

soxofaan - April 16, 2008 - 22:08

Please also check:

Does CAPTCHA 6.x-1.0-rc2 work on other things like the comment forms?
Please check for both anonymous as authenticated users (without skip CAPTCHA permission of course).

#5

vortechs - April 21, 2008 - 17:53

I am seriously confused now. AFAIK, I didn't touch anything, but now captchas are working fine. So, 6.x-1.0-rc2 works fine for me in Drupal 6.2.

#6

peregrina - May 2, 2008 - 21:05

i am also getting this "Invalid CAPTCHA Token." with captcha rc2any module(reCaptcha, captchapack...)

#7

soxofaan - May 3, 2008 - 08:45

@peregina: please provide more information (which forms, which user roles)
also try the CAPTCHA with authenticated users without the skip CAPTCHA permission

#8

peregrina - May 3, 2008 - 15:24

well, if i remove the skip captcha in all roles, it works. I bet theres the error.

#9

soxofaan - May 5, 2008 - 09:30
Priority:critical» normal
Status:active (needs more info)» fixed

it's fixed then

#10

Lovecannon - May 5, 2008 - 20:10
Status:fixed» active

No its not. I still get the same error, and Ive tried reinstalling the module and everything, it keeps coming up with Invalid Token errors every time, and no users had the 'Skip captcha' permission, so I dont know whats wrong with it, it just suddenly stopped working overnight, i hadnt installed any new modules, it just stopped working. Its really really annoying, so I just disabled the module and removed it until the next release. I was only using it to protect login/registration forms anyway.

#11

soxofaan - May 6, 2008 - 09:11
Category:bug report» support request
Status:active» active (needs more info)

I can't reproduce this error with
* Drupal 6.2
* CAPTCHA 6.x-1.0-rc2
* math CAPTCHA on user registration form

The error message "invalid CAPTCHA token" is a typical symptom of session problems. The CAPTCHA solutions are stored server side in the session data, so sessions are required for CAPTCHAs to work. (CAPTCHA 6.x-2.x probably won't have this requirement.)

Getting "Invalid CAPTCHA token" for anonymous user typically means that anonymous users don't have persistent session data.
This often happens when there is no entry for uid=0 in the users table. Also see
#245451: Image is not visible because of no uid=0 in users table
#243285: Captcha not working when no sessions for anonymous
#179915: Resolved: Captchas don't work on second site (was missing user UID 0 in database)
#204095: Error: 'Cookies should be enabled in your browser for CAPTCHA validation.'

If I delete the entry with uid=0 in my users table, I can reproduce the error.

So please check if you have an entry for uid=0 in the users table of your database
or
try CAPTCHA on for example comment forms with an authenticated user (a user that is logged in) without the skip CAPTCHA permission

#12

soxofaan - May 6, 2008 - 09:37
Status:active (needs more info)» patch (code needs review)

This patch adds a check for uid=0 in the users table and shows an error on the status report if it's not available.

AttachmentSize
nouid0.png42.15 KB
245720_no_uid0_01_D6.patch1.02 KB

#13

soxofaan - May 17, 2008 - 15:39
Version:6.x-1.0-rc2» 5.x-3.x-dev
Assigned to:Anonymous» soxofaan
Status:patch (code needs review)» patch (to be ported)

committed attached patch: http://drupal.org/cvs?commit=116712

To be ported to DRUPAL-5--3
Not an issue in HEAD because that branch does not depend on sessions

AttachmentSize
245720_uid0requirement_02_DRUPAL-6--1.patch2.25 KB

#14

soxofaan - June 9, 2008 - 09:07
Status:patch (to be ported)» fixed

committed in DRUPAL-5--3
http://drupal.org/cvs?commit=120249

#15

Anonymous (not verified) - June 23, 2008 - 09:16
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

#16

stham01 - July 7, 2008 - 16:29
Version:5.x-3.x-dev» 6.x-1.0-rc2

Did anyone ever figure this one out? I only use CAPTCHA for user login
any riddler login gets rejected once, with the error message
Invalid CAPTCHA token.

Second try lets you log in, but takes you to an 'Access denied' page

site: hautboy.org
Drupal 6.2
Captcha rc2

#17

soxofaan - July 7, 2008 - 19:38

are cookies enabled?
do other challenges work (like the builtin math captcha)?

#18

junk@netlumina.com - July 27, 2008 - 18:11
Status:closed» active (needs more info)

Sorry, but this is NOT closed. The problem has been identified. But what's the solution?

#19

soxofaan - July 27, 2008 - 20:04

The problem has been identified

Well, the problem is that there are several causes for getting the "invalid CAPTCHA token" error.
This thread is getting a bit messy with low signal-to-noise-ratio and different people with possibly different problems.

So if you want to contribute to this thread, or want this thread to be useful:
Please be very precise in describing your setup (which versions of drupal, modules, which browsers, cookies, users, forms, permission, etc) and the procedure to get the error message. I still can't reproduce the problem on my setup, which makes it very hard for me to debug, let alone to fix, something ;-)

#20

agiliter - October 8, 2008 - 15:52

I don't know if this is relevant to this thread, but apparently people with IE7 will get this "Invalid CAPTCHA Token" if they have their Tools|Internet Options>Privacy setting set to "High" or to "Block All Cookies". It will work with setting set to "Medium High"

This with D6.4, CAPTCHA 6.x-1.0-rc2, and ASCII Art CAPTCHA 6.x-1.0-beta2.

 
 

Drupal is a registered trademark of Dries Buytaert.