Laravel - Nexmo "Please provide Nexmo API credentials" Error - php

I want send send SMS with laravel-Nexmo. I already configure all the settings. But when i try to send a SMS it gives this error
Please provide Nexmo API credentials. Possible combinations: api_key +
api_secret, api_key + signature_secret, private_key + application_id,
api_key + api_secret + private_key + application_id, api_key +
signature_secret + private_key + application_id
I added nexmo api_key & secret_key in services.php , .env file and nexmo.php
I also added this;
curl.cainfo="C:\xampp\apache\bin\cacert.pem" in php.ini file
What is the reason for this error and how to fix this? Thank you!

I already configure all the settings.
What exact settings did you configure? The error means that the library could not determine an appropriate set of credentials to use for Nexmo.
If you are sending an SMS, all you need to set is NEXMO_KEY and NEXMO_SECRET. I would try setting just those two environment options and see if you get the same error. If you are using request signing by setting NEXMO_SIGNATURE_SECRET, I would disable that for the time being just to check that sending a base SMS works.
Once you update your settings, I would make sure that the cache is cleared using artisan config:clear to clear the cache, which should allow the settings to be picked up on the next page load.

I ran into the same issue, and was able to fix it.
Cause
It looks to me like laravel/nexmo-notification-channel has been updated, but Laravel itself hasn't (yet).
According to the Laravel [6.x] pull request:
composer require laravel/nexmo-notification-channel
This will also install the nexmo/laravel package. This package includes its own configuration file. You can use the NEXMO_KEY and
NEXMO_SECRET environment variables to set your Nexmo public and secret
key.
https://github.com/laravel/docs/pull/5519/files?short_path=7c04c15#diff-7c04c1591e2821d381785df56ebd70af
Solution
It was easy, just copy this new nexmo.php config file into your config folder: https://github.com/Nexmo/nexmo-laravel/blob/master/config/nexmo.php
As long as you have the NEXMO_KEY and NEXMO_SECRET set in your .env file, it should now work.

I am using Laravel 8 and faced the same issue. Then I realize that I was adding
NEXMO_KEY=your key here
NEXMO_SECRET=your secret here
to .env.example file. I just added it to .env file and re-config the cache by php artisan config:cache
Now it's working.
Note: you should get your api_key and secret rom vonage.com

Related

Sentry Please check if your DSN is set properly in your config or .env as `SENTRY_LARAVEL_DSN`

I've installed Sentry on my Laravel project but I can't run it, whenever I run command php artisan sentry:test the result is:
[Sentry] DSN discovered!
[Sentry] Generating test Event
[Sentry] Sending test Event
[Sentry] There was an error sending the test event.
[Sentry] Please check if your DSN is set properly in your config or `.env` as `SENTRY_LARAVEL_DSN`.
but I've added the DSN in my .env file
Make sure to put the DSN in the .env file like this
SENTRY_LARAVEL_DSN=https://34412344274048ccbfasfdgdffaf7f38d47c#o111111111.ingest.sentry.io/222334456
and don't forget to cache the config
PHP artisan config:cache
You find you DNS address in your Sentry account under "Client Keys" in your project settings.
When you have located the DNS address copy it and add it to your .env file like this:
SENTRY_LARAVEL_DSN=YOUR_SENTRY_DSN_HERE
To handle unhandled errors you also need to put this in your App/Exceptions/Handler.php:
public function register()
{
$this->reportable(function (Throwable $e) {
if (app()->bound('sentry')) {
app('sentry')->captureException($e);
}
});
}
You probably already have a register method there. If it empty you should replace it with this. If you have something there you probably have to merge this register with your current one. If you want help with that, post your current register method here.
After this php artisan sentry:test should work. You might have to clear the cache if you have config cache turned on in your environment. After you have verified that is works you should probably remove the DSN from you .env in your local environment and add it to your production and staging environments if you have any.
Here is a link to the Sentry documentation: https://docs.sentry.io/platforms/php/guides/laravel/
I would also recommend that you enable performance monitoring. It is a great feature!

Laravel Verify Email Address Issue

I have a problem with Laravel 5.7.22, I tried to activate the verification with the email and I get the message that:
A fresh verification link has been sent to your email address.
how it's properly working at least the part that send the emails with the verification link but when I click the generated link I get the following page:
I have tried to erase the project and reinstall it, and I also tried to generate the signature key with this command:
php artisan key:generate
that I have found in this other question, but that didn't work, I don't know what could be causing this issue.
I also tried to debug the the function hasValidSignature in the file UrlGenerator from Laravel, just because I read that it could help, but it doesn't make sense, I haven't event altered the middleware or something I'm just with the laravel routes that it generates by default.
The generated link looks something like this.
https://www.example.com/email/verify/1?expires=1548527438&signature=daebab97afbb2da6a0f37615bc3db7e59db9c59e704d185addcf88adf46e8f6d
I also have configured my .env file properly and the files under the config folder just for security.

Bigcommerce app - How to change the Auth Callback URL

I am new to Bigcommerce app
From the sample github,
https://github.com/bigcommerce/hello-world-app-php-silex
How to give the
Auth Callback URL: https://<app hostname>/bigcommerce/callback
Load Callback URL: https://<app hostname>/bigcommerce/load
Uninstall Callback URL: https://<app hostname>/bigcommerce/uninstall
where,
<app hostname> represent
http://localhost/repo/hello-world-app-php-silex (or)
http://XXX.mybigcommerce.com/hello-world-app-php-silex
In the point 5,
they mentioned as "Restart the software or the entire host as needed to set the environment variables." How to restart ?
When you add the Auth Call back URL's to your .env file as per the example. You need to restart the web server. That is the point mentioned on the GitHub page.
BC_AUTH_SERVICE=https://login.bigcommerce.com
BC_CLIENT_ID=<contents of Client ID field>
BC_CLIENT_SECRET=<contents of Client Secret field>
BC_CALLBACK_URL=<URL TO YOUR AUTH CALLBACK ENDPOINT>
Also, note that the BC_CALLBACK_URL has to be the same you setup in developer portal when you configure the app.

Laravel 5.3 url() function alway print http://localhost

I have just switch to new version of laravel i.e. 5.3 for my new project.
Once I need to send registration mail to my portal customer, where registration mail contains account activation link where this mail is sent using Mail::queue.
I am generating that link using url("activate/$random_string");
and which always prints http://localhost/activate/$random_string_value
but what i wants is,
http://localhost/project/public/activate/$random_string_value
or
http://192.168.0.45/laravel/public/activate/$random_string_value
(above result i am getting till laravel 5.2)
i have set APP_URL value in .env as well and in config/app.php as well,
I have tried php artisan config:clear and php artisan config:cache
Can anybody help me to sort out this issue. I have one possible solution is to use env('APP_URL') to genrate same url.
I think your url need to update like:
url("activate/".$random_string);
Hope this work for you!

Add syslog handler in Laravel for paperTrail .

How could i link Laravel log files to PaperTrial ?
According to this article :
http://mattstauffer.co/blog/laravel-forge-logging-with-papertrail#step-4-add-a-syslog-handler
I followed steps and reached to step 4 putting Syslog Monolog handler in the /app/route.php file ,went to PaperTrial dashboard but i didn't see any output.
Any help ? thanks.
For Laravel 5.1 after setting up the forge, you should add to bootstrap/app.php file the following code just before the return of the $app variable
$app->configureMonologUsing(function($monolog){
$monolog->pushHandler(new Monolog\Handler\SyslogHandler('papertrail'));
});
return $app;
The parameter (in this case 'papertrail') can be whatever you want to, this name will show on the papertail's event screen.
I have it working using the standard logging facility instead of Monolog. This way there is nothing extra to install. Just add this to rsyslogd's conf:
### Laravel Log
$InputFileName /path/to/vhost/dir/app/storage/logs/laravel.log
$InputFileTag laravel-errors-domain.com:
$InputFileStateFile state-laravel-errors-domain.com
$InputFileSeverity error
$InputRunFileMonitor
And make sure that this log gets included in the send action, if you are not sending everything.
Then issue
service rsyslog restart
From my experience using Laravel 5.2.* with Forge, Step 4 from that article is not necessary anymore. All you have to do after Step 3 is set your Environment .env settings in Forge to APP_LOG=syslog for each site you want to use with papertrail.
However, this means that Laravel will not log to laravel.log anymore in this environment. But, in other environments (e.g. dev environment) you could of course continue logging to laravel.log by simply not making any changes to the .env file there.

Categories