0

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

Nitesh Pogul
  • 180
  • 1
  • 6
  • Hey, I'm a developer evangelist for Twilio. I'm no PHP expert, but that does look correct to me. I would double check that you have got the `$sid` and `$token` correct as that is what is most likely to cause an Authenticate error. – philnash Dec 16 '14 at 10:52
  • But I am using the corrent auth key and token – Nitesh Pogul Dec 16 '14 at 15:40
  • Hey Nitesh, did you double check that? I'd suggest copying the SID and auth token from your dashboard again, just to make sure. Let me know if you still get the error again after doing that. – philnash Dec 16 '14 at 15:42
  • I have checked the same but it shows the same error – Nitesh Pogul Dec 17 '14 at 08:21
  • I just copied the code and used my own account id and auth token and it worked, I'm not sure what else to suggest! Could you email me at philnash@twilio.com and send me your account SID and I'll see what I can do. – philnash Dec 17 '14 at 13:07

1 Answers1

0

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

Andrei Bazanov
  • 352
  • 2
  • 11