mostafaznv/recaptcha

Validation always return captcha error

Closed this issue · 4 comments

Hi, i tried to make the recaptcha v3 similar to this readme for validation.

$this->validate($request, [
        'g-recaptcha-response' => 'required|recaptcha:home,0.5',
 ]);

It always return captcha error by validation "Captcha error! try again later or contact site admin." (I already added the custom validation message though). What's wrong with this? Please help. Thanks in advance.

Hi.
I checked your code, It's OK and I couldn't see any error on that.
It seems you are getting error from Google's server, to clarify what's going on, please validate the recaptcha code manually and check the score you are getting from server.

Hi @mostafaznv. I checked it like this.

if($score > 0.5) {
      dd("pass");
} else {
      dd("fail");
}

Just ignore the dd function. I just intend to check whether if it pass or not. And the result is it pass. But, when i using re-submit data without back it is fail. Do the mechanism like that? Thanks in advance.

You can't re-submit data without refresh page. because you are sending a recaptcha token that is used before and is not valid anymore.

Ok thanks. I think the problem is just with the custom validation of laravel. Thanks a lot.