google recaptcha v2 in livewire component comes with issues - php

I'm trying to implement google recaptcha v2 with livewire but I get some issues :
The issue that I get is when I try to call RECAPTCHA_SITE_KEY from the .env file it display me this error message in Dev Console :
"Uncaught Error: Missing required parameters: sitekey"
it confusing because the site key is correct and is already exist inside .env file.
Wile I remove the {{ env('RECAPTCHA_SITE_KEY') }} from data-sitekey and add the site key it work
Not Working example :
data-sitekey="{{ env('RECAPTCHA_SITE_KEY') }}"
"Uncaught Error: Missing required parameters: sitekey"
Working example :
data-sitekey="XXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
Where this problem coming from ?

First, double check that is is spelled exactly the same in your .env. Second, run php artisan cache:clear in case your config is cached. Third, attempt env('RECAPTCHA_SITE_KEY'); from php artisan tinker and see what results you get.

Related

Fresh Laravel Nova returns 419 expired after form submit

I've added Laravel Nova to my Laravel app (v7.x). There is nothing special configured within my middlewares/service providers/etc.
Whenever I submit a form from Nova, it results in a 419 Page expired error.
The VerifyCsrfTokenMiddleware throws an error, saying there is a "CSRF token missmatch".
All views and assets are default as they came by the Laravel Nova installation script.
Any idea, what causes this problem?
I recently faced the same problem. I resolved it by adding the following line to my .env file:
SESSION_DOMAIN=.domain.tld
Where domain.tld is your domain obviously. Don't forget the initial dot.
Also, if you're using Laravel passport and your site is fresh, don't forget to execute php artisan passport:install

php artisan serve command display error message

I am using php 7.3.2 on window 7. When I try to run php artisan serve, it shows this error on the webpage:
Whoops, looks like something went wrong.
Is it related to the message that I received when I want to migrate database, it says
Application In Production!
My error in laravel log shows
production.ERROR: RuntimeException: The only supported ciphers are AES-128-CBC and AES-256-CBC with the correct key lengths. in C:\xampp\htdocs\Inventory\vendor\laravel\framework\src\Illuminate\Encryption\Encrypter.php:43
Following the error in your log file you seem to be missing your key attribute in your .env file. See this SO question for a solution.
To generate the secret key, run
$ php artisan key:generate
make sure to follow the official docs when installing Laravel.
Your laravel is running in production mode. If you are developing local, you should switch that for your local maschine.
To do so: In your .env set the APP_ENV to local (APP_ENV=local) and try again.
Now, you will see the full error message and you are able to handle it now.

How to fix NoCaptcha error with site key?

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?
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
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
...

how can i publish HTML and plain-text template used by mail notifications in laravel?

when I run this command :
php artisan vendor:publish --tag=laravel-notifications
To publishing the HTML and plain-text template used by mail notifications,this throws the following error :
[UnexpectedValueException]
Invalid route action: [App\Http\Controllers]
Why this is happening?
Looks like it's not related to vendor:publish. The error is telling you that one of the uses clause in your route file web.php (default) is not recognisable, or not defined, or malformed. Make sure all uses is indeed pointing to defined Controller#action.

Laravel 4 Commands stopped working suddenly

Back from vacation, and when I'm trying to run one of my previously working command:
php artisan list
Throws me:
[root#api2]# php artisan list
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Call to a member function getArgument() on a non-object","file":"\/var\/www\/html\/api2.alariscms.com\/vendor\/laravel\/framework\/src\/Illuminate\/Console\/Command.php","line":153}}
And I seriously cannot understand why this happens. I tried debugging the file that throws an error. It awaits argument:
InputInterface $input but it gets NULL
I don't know what can go wrong on a framework level to stop receiving the required object.
Any ideas where to start debugging from? Or I can reload configurations / update laravel via cmd?
Thanks
This is what I would do:
php artisan dump
composer dump-autoload
check for current Laravel version
and then go to that specific command and check for bug there.
Also, what kind of argument are you trying to pass to command ? Is that object - if so check where is implementation of that class ?

Categories