abinnovision/recaptcha-v3

reCaptcha invalid JSON response

Closed this issue · 2 comments

Faced an invalid JSON in the server response. Server response starts with ")]} '".
Found an old topic on StackOverflow
It seems that this is still relevant at the moment, maybe not always, but a similar server response comes as a check.
Maybe you should consider this when parsing the server response?

I also had this confusion just now, but now I have obtained the token, which is not expressed in the demo.

Don't care about the return value of http request, just get the token in the code

async recaptcha() {
      // Execute reCAPTCHA with action "login".
      const token = await this.$recaptcha('login')

      // Print the token directly in the console
      console.log(token);
    }

This library actually just depends on the official Google reCAPTCHA API. That basically means that this library does not send the actual request.