1

I'm trying to grab Twilio recordings with the following GET request to their API in my Rails controller:

def myrecordings
    account_sid = 'AC32a3c49700934481addd5ce1659f04d2'
    auth_token = 'asd89f677asd897asdfd9' #this is made up for now
    client = Twilio::REST::Client.new(account_sid, auth_token)
    @recordings = client.account.recordings.list() 
    render :json => @recordings
end

As a result I'm getting a 500 response error with the message "Authenticate"

My application trace is
app/controllers/campaigns_controller.rb:13:in `myrecordings' [the @recordings line]

To the best of my knowledge I'm following what are in the Twilio docs here:
http://www.twilio.com/docs/api/rest/recording

But clearly I'm missing something. The account_sid and auth_token are correct, but is there a security issue?

4

1 回答 1

1
require 'rubygems'
require 'twilio-ruby' # Download twilio-ruby from twilio.com/docs/libraries
# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'AC32a3c49700934481addd5ce1659f04d2'
auth_token = '{{ auth_token }}'
@client = Twilio::REST::Client.new account_sid, auth_token
# Loop over recordings and print out a property for each one
@client.account.recordings.list.each do |recording|
  puts recording.sid
end  

从文档中,这也应该有效,假设您将 sid 和 token 更改为正确的

于 2013-06-05T00:41:43.870 回答