Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twilio REST API error - "Authenticate"

I'm getting the following error when I try to place calls using the Twilio REST API.

https://www.twilio.com/docs/api/rest

HTTP/1.1 401 Unauthorized 
Server: nginx 
Date: Thu, 10 May 2012 16:50:48 GMT 
Content-Type: application/xml 
Connection: close 
WWW-Authenticate: Basic realm="Twilio API" 
Etag: 
Last-Modified: 
Content-Length: 233 

401 Authenticate 20003 
http://www.twilio.com/docs/errors/20003

I googled, but found nothing. Anyone had this issue?

What I POSTed on the API call was:-

$url = 'https://api.twilio.com/2010-04-01/Accounts/ACdxxxxxxx/Calls';

From => +1415xxxxxx 
To => +1646xxxxx
Url => http://173.201.xx.xx/Test/Twilio/twilio_test.php
like image 314
Sparky Avatar asked May 10 '12 16:05

Sparky


People also ask

How do I authenticate Twilio API?

You can authenticate with Twilio's API using the Account ID as the username and the primary or secondary auth token. If the primary token is compromised, you can promote the secondary token to the primary token which will make the old primary token unusable.

How do I verify my Twilio credentials?

Your account's test credentials can be found on the API Keys & Tokens page in Console. Scroll down to the Auth Tokens section to see your Test Credentials.

How do I get my Twilio Auth Token?

Access the Account -> API keys and tokens page in Console. Scroll down to the "Auth Tokens" section, and then click Request a secondary token. In the pop-up dialog box, click Request Token. Click the Eye icon to view your new secondary token, and use it to update your existing Twilio applications.

What is REST API in Twilio?

The Twilio REST API allows you to query metadata about your account, phone numbers, calls, text messages, and recordings. You can also do some fancy things like initiate outbound calls and send text messages.


2 Answers

It seems there are a few causes for this error. I discovered I receive an "Authenticate" error when my account funds have been depleted. When I added funds, it worked again without any problems.

like image 51
PTK Avatar answered Sep 21 '22 19:09

PTK


This same problem happened to me. I had made some successful API requests and reached a stopping point in my App, and I decided to publish to GitHub. Moments later I tried running my App, and my server was crashing when I made my Twilio API requests; and the console was saying I needed to authenticate. It turns out I had not added my .env to the .gitIgnore and I unknowingly published my accountSid to GitHub. Twilio sensed this and immediately suspended my accountSid. I am waiting for them to generate a new accountSid for me.

like image 44
Indigo Avatar answered Sep 19 '22 19:09

Indigo