Vonage / vonage-php-sdk-core

Vonage REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
916 stars 180 forks source link

Request Unauthorized with Make Call Nexmo #129

Closed dflow closed 5 years ago

dflow commented 5 years ago

local.ERROR: Nexmo\Client\Exception\Request: Unauthorized in /home/vagrant/Projects/calls/vendor/nexmo/client/src/Call/Collection.php:163 Stack trace:

no idea why this is not working and I cannot debug it, using the following code on a local machine. contacted the support but they could not help. I have setup an Application and linked a number as well

`

 $basic  = new \Nexmo\Client\Credentials\Basic('4xxxxxxx', 'xxxxxxxxxxxxx');
$keypair = new \Nexmo\Client\Credentials\Keypair(
    file_get_contents(__DIR__ . '/private.key'),
    'eb886ba5-5dea-4071-a8fe-xxxxxxxxx'
);
    $client = new \Nexmo\Client(new \Nexmo\Client\Credentials\Container($basic, $keypair));

$client->calls()->create([
    'to' => [[
        'type' => 'phone',
        'number' => xxxxxxxxxx
    ]],
    'from' => [
        'type' => 'phone',
        'number' => 12345678901
    ],
    'answer_url' => ['https://example.com/api/nexmo_answer_url'],
    'event_url' => ['https://examplei.com/api/nexmo_event_url']

]);`
lornajane commented 5 years ago

Hmm, I'm not sure exactly what could be wrong here. To eliminate a problem with the application or keyfile could you try:

dflow commented 5 years ago

thanks but that did not resolve the issue

dflow commented 5 years ago

just to update this works on my remote server but not locally, I am using a laravel homestead box

lornajane commented 5 years ago

That's interesting. Perhaps the homestead community would have some suggestions for you - I'm pleased to hear you got the code working in any case!

NEST387 commented 5 years ago

Hi, did you find any solutions for this problem ? I am stack with this also ..

lornajane commented 5 years ago

I'll close this because I think it was platform specific, but if you have more information do feel free to re-open or update this issue. Thanks!