0
votes

I'm getting this error:

[HTTP 404] Unable to fetch record: The requested resource /2010-04-01/Accounts/AC********************.json was not found

When I try to create a Twilio Client like this:

new \Twilio\Rest\Client(env('TWILIO_ACCOUNT_SID'), env('TWILIO_AUTH_TOKEN'), $customerAccountSid)

TWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN are from an API key I created at https://www.twilio.com/console/project/api-keys I chose "Main" key type because the other gave an even worse error.

And then $customerAccountSid is an "AC" account ID that Twilio sent back to my app when I click on a "Connect" button that links to https://www.twilio.com/authorize/CN******** where that "CN" ID is my Connect SID, and the "AC" account is a 2nd account I set up for testing.

Why can't the Twilio client fetch the account? It should be authorized to connect now...

1

1 Answers

1
votes

Twilio developer evangelist here.

I think this is similar to our other discussion, but for more information, Connect apps pre-date API Keys and are intended to work with Account SIDs and Auth Tokens.

So, to fix this you will need to use your account's auth token and the connect account's SID to make requests.

new \Twilio\Rest\Client($customerAccountSid, env('TWILIO_AUTH_TOKEN'), $customerAccountSid)