django-recaptcha / django-recaptcha

Django reCAPTCHA form field/widget integration app.
https://pypi.org/project/django-recaptcha/
BSD 3-Clause "New" or "Revised" License
988 stars 264 forks source link

Recaptcha V3 fails to validate #199

Open zelenij opened 4 years ago

zelenij commented 4 years ago

Hi, I tried using V3 like this:

captcha = ReCaptchaField(
        error_messages={'required': _('Must pass captcha')},
        widget=ReCaptchaV3(attrs={'required_score': 0.85})
    )

However, base form code failed validation saying that the field was required. I switched to V2, by commenting out the widget line, and it seems to be working just fine.

NB: I am using the test mode, i.e. no actual API keys registered yet, still in development.

cpattersonit commented 4 years ago

I get the same results when trying V3 with test keys. When I tried it with real API keys, I get no widget, along with the following result in the console:

Uncaught ReferenceError: grecaptcha is not defined

Edit: I was able to get V3 to work with real API keys. Turns out I was incorrectly using my keys from v2 - Checkbox, I apologize for my mistake. However, the test keys still don't work for me.

andylamp commented 4 years ago

does this issue still exists? it seems I am getting the same with default testing key when using the latest officially released version on pypi.

alanverresen commented 9 months ago

As discussed in [1], the test keys provided by Google for everyone to use, can only be used for reCAPTCHA v2, and developers need to create their own test keys for reCAPTCHA v3.

Should a check be added to the constructor of ReCaptchaField, to inform developers that they cannot rely on the default "test keys" when using the reCAPTCHA v3 widget?

[1] Frequently Asked Questions  |  reCAPTCHA  |  Google for Developers