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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
todofixthis's avatar
1.3k
todofixthis
asked 13 years ago, updated 13 years ago

Comments

1

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

nr's avatar nr (12 years ago)
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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Evgeny's avatar
13.2k
Evgeny
answered 13 years ago, updated 13 years ago
link

Comments

Applied to the hosted sites.

Fitoria's avatar Fitoria (13 years ago)

@todofixthis - does ReCaptcha work for you now?

Evgeny's avatar Evgeny (13 years ago)

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 (13 years ago)
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...

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
A. Pritschet's avatar
1
A. Pritschet
answered 11 years ago, updated 11 years ago
link

Comments

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
CoderCA's avatar
1
CoderCA
answered 11 years ago
link

Comments

see more comments