Twilio Error : Authenticate

1.5k Views Asked by At

Hello Developers I am using the Twilio API and Purchased a Number.

I have also created a secure SSL site uploaded the following code. Then it will show the following error as

Error : Authenticate

<?php
// Include the Twilio PHP library
require 'Services/Twilio.php';

// Twilio REST API version
$version = '2010-04-01';

// Set our AccountSid and AuthToken
$sid = 'myWorkingSID';
$token = 'myWorkingAuthToken';

// Instantiate a new Twilio Rest Client
$client = new Services_Twilio($sid, $token, $version);

try {
    // Get Recent Calls
    foreach ($client->account->calls as $call) {
        echo "Call from $call->from to $call->to at $call->start_time of length $call->duration";
    }
} catch (Exception $e) {
    echo 'Error: ' . $e->getMessage();
}

Kindly help me in this issue

1

There are 1 best solutions below

0
On

I had exactly the same issue. In my case, I had a subaccount. And each subaccount has its own account SID and Auth Token. As soon as I used the subaccount credentials it worked (and by "it worked" I mean I got a different error, which is always good news).