Always getting RecaptchaNotResolvedException
Closed this issue · 5 comments
Hi,
I followed the integration steps for your captcha library and I am getting RecaptchaNotResolvedException
error.
Frontend side works great, the token is injected into my form. I'm using $request->isRobot()
in my controller as you write in the instructions but I still get the exception. I dug little deeper using xdebug and I discovered that DarkGhostHunter\Captchavel\ReCaptcha::setResponse()
was called with proper data (I used the CAPTCHAVEL_LOCAL
option) when I submit the form. So the middleware works too obviously.
But the $request->isRobot()
function is calling a helper method which calls app('recaptcha')
behind the scenes and I'm getting DarkGhostHunter\Captchavel\ReCaptcha
instance with response
set to null. It seems that the Laravel is creating a new instance instead of returning the instance where setResponse()
was called in the middleware.
Laravel version: 5.8
Captchavel version: 1.1
Do you have an idea how to fix this?
I'll check. Care to share the code in your Controller? I need to replicate it.
Any error log is also appreciated.
By the way, the reCAPTCHA Response is being set in the Middleware
I think I figured it out.
I registered the reCAPTCHA class as a string, but in the Middleware I use DI, which is weird. I'll give it a fix so it points out the same singleton.
Until the fix, I suggest you to use DI in your Controller.
Fixed in v1.1.1 by #7
Thank you! It's working now perfectly.
Glad. Anything, hit the issue tracker.