Home » Php » php – How to fix NoCaptcha error with site key?

php – How to fix NoCaptcha error with site key?

Posted by: admin July 12, 2020 Leave a comment

Questions:

In my my laravel 5.7.3 application I use https://github.com/anhskohbo/no-captcha
For this I installed this package and added refs to config/app.php file.
After that I went By link and with my google account I have next account :
https://imgur.com/a/leBrPOt

But inserting next rows in my blade template:

    <div class="form-row mb-3">
        {!! NoCaptcha::renderJs() !!}
    </div>

and in my .env file I added lines :

NOCAPTCHA_SECRET=6LcRPHEUAAAAAKXPSZt0Hjjibxa1p_iq6XbH6sFk
NOCAPTCHA_SITEKEY=6LcRPHEUAAAAAPx8iLqBT1bThH1XfIhdcDYs-ssU

as I see I entered valid NoCapture parameters and published config file.
after I cleared the cach with commands :

php artisan cache:clear
php artisan config:cache

But on my form I see image recapture block with error :

ERROR for site owner: Invalid site key

I did not insert any code in my control or in my blade template, as it was not mentioned in docs.

Why error ? Did I miss some options?

How to&Answers:

in addition to @Mohammad’s answer, The idea is that the error is coming from google not from the package.

The issue is most likely with the specification of domains.
Add all the domains accordingly including the development domains, as seen in the image. Link to recaptcha
recaptcha

Answer:

I think your chosen domains are wrong.

If it is localhost, be sure to enter the API KEY localhost or domain.com creation time.

or multi domain :

localhost
domain.com
...