pdupavillon / express-recaptcha

Implementation of google recaptcha v2 & V3 solutions for express.js
MIT License
128 stars 21 forks source link

Question about captcha challenge #11

Closed lbelinsk closed 7 years ago

lbelinsk commented 7 years ago

Hey @pdupavillon, I have a question about the verify process. I am using this lib to perform validation on the server, and I see that the captcha is failing sometimes with the error: invalid-input-response

I am using the invisible captcha.

I don't understand how can I reproduce this error. When I try to fail the challenge on purpose for over than 5 minutes, I don't see any error, just keep on getting a fresh new challenge.

So do you have any idea what can trigger that error?

Another question - When the challenge popup is visible, when you click outside of it the popup is closing. Is there any event for that? Something like onClose or something?

Thanks..

pdupavillon commented 7 years ago

Hi @lbelinsk and thanks for using this lib, The captcha verification on server side is done by an https request to the google api made on this url : https://www.google.com/recaptcha/api/siteverify There are plenty of reasons that Recaptcha could failed :

  1. Network failure, timeout, on server side.
  2. The response message return by google has the property success set to false and there is no error message.
  3. This message is returned explicitly by google in error-codes property.
  4. The g-recaptcha-response isn't present, because the form was submit too quickly.

If this is the reason number 4, you could try this : Submit your form either by hitting the enter key or by pressing the submit button of your form and check the request params in you dev console, if the g-recaptcha-response is not there, so you will have your answer :).

AFAIK, for the challenge popup, there is no event that could be bind to it, in the google developer doc.