First time here? Check out the FAQ!
1

"Input error: k: Format of site key was invalid" when reCAPTCHA is turned on

I had reCAPTCHA turned on in /settings/EXTERNAL_KEYS/ on my hosted site, but when people went to create new accounts, they saw the following instead of the reCAPTCHA interface:

Please read and type in the two words below to help us prevent automated account creation.
Input error: k: Format of site key was invalid

I double-checked, and I did input my reCAPTCHA exactly as it appears on my account info on http://google.com/recaptcha.

For reference, here are the keys I was using (they have since been deleted, so they won't work anymore):

  • Public Key: 6Ld7UM8SAAAAAGrn74ADTPQLi8DfYikQH3_WmkgA
  • Private Key: 6Ld7UM8SAAAAAB-pIUr_5ki8PTuWWMLDf0eYo3DX
todofixthis's avatar
1.3k
todofixthis
asked 2012-03-24 10:28:46 -0500, updated 2012-04-14 15:39:50 -0500
edit flag offensive 0 remove flag close merge delete

Comments

1

Got the same error. Be sure to restart your server after saving the new settings for reCaptcha.

nr's avatar nr (2012-09-12 05:58:35 -0500) edit
add a comment see more comments

3 Answers

1

I don't know exactly why, but adding to settings.py RECAPTCHA_USE_SSL = True solves this problem for me.

Possibly Google (current owner of the service) now requires encryption... We'll add this setting to the future release and the hosted sites.

Evgeny's avatar
13.2k
Evgeny
answered 2012-04-15 16:53:39 -0500, updated 2012-04-15 16:53:54 -0500
edit flag offensive 0 remove flag delete link

Comments

Applied to the hosted sites.

Fitoria's avatar Fitoria (2012-04-16 14:27:32 -0500) edit

@todofixthis - does ReCaptcha work for you now?

Evgeny's avatar Evgeny (2012-04-17 15:50:39 -0500) edit

Generated new public/private keys and turned recaptcha on, but getting the same error as before when I go to create an account.

todofixthis's avatar todofixthis (2012-04-17 16:19:42 -0500) edit
add a comment see more comments
0

Have the exact same problem and took the liberty of taking a look at the HTML code of the page and the settings.py of the recaptcha module. I think I found the source of the error:

_RECAPTCHA_HTML = u'''
%(options)s
<script type="text/javascript"
   src="%(proto)s://www.google.com/recaptcha/api/challenge?k=%(public_key)s">
</script>
<noscript>
   <iframe src="%(proto)s://www.google.com/recaptcha/api/noscript?k=%(public_key)s"
       height="300" width="500" frameborder="0"></iframe><br>
   <textarea name="recaptcha_challenge_field" rows="3" cols="40">
   </textarea>
<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
</noscript>
'''

As you can see, there are three variables options, proto and public_key supposed to be rendered into the string, but nothing is defined!

A quick and dirty solution is to replace %(public_key)s with your actual public key...

A. Pritschet's avatar
1
A. Pritschet
answered 2013-06-23 14:27:34 -0500, updated 2013-06-23 14:30:38 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments
0

One quick thing to check is if you switched from an AJAX display for your captcha to a PHP based display and left in:

showRecaptcha(element)

Then comment out that function / function call, took me a while to figure out because it would only error out every 2/5 times depending on how fast the JavaScript loaded.

CoderCA's avatar
1
CoderCA
answered 2014-04-09 04:38:34 -0500
edit flag offensive 0 remove flag delete link

Comments

add a comment see more comments