Twilio-Ruby 407身份验证错误

时间:2015-11-12 10:06:44

标签: ruby-on-rails api twilio

我正在开发一个Rails应用程序。它使用Twilio-Ruby发送一些电话号码验证请求。

在控制台中我做:

 @client ||= Twilio::REST::LookupsClient.new 
        "AC1230503237c2647f7f9d5821c6f39e64", 
        "f8829cefe14193cf35d5ec443f5f3e87"

        response = @client.phone_numbers.get("1235585781")
        response.phone_number

它给了我以下错误:

Net::HTTPServerException: 407 "Proxy Authentication Required"
        from ~/.rbenv/versions/2.2.3/lib/ruby/2.2.0/net/http/response.rb:119:in `error!'

任何帮助都会很棒,谢谢!

2 个答案:

答案 0 :(得分:0)

Twilio这是一个非常聪明的黑客加密密码。

请参阅此处https://andrewjprokop.wordpress.com/2015/01/27/understanding-sip-authentication/

Twilio-Ruby需要实现对此的支持。

答案 1 :(得分:-1)

Twilio开发者传道者在这里。

您似乎在代理服务器后面,需要提供Twilio Lookups Client详细信息。您可以在初始化客户端时传递这些内容。像这样:

@client ||= Twilio::REST::LookupsClient.new(
  account_sid, 
  auth_token,
  proxy_addr: proxy_addr # The domain of a proxy through which you'd like the client to make HTTP requests.
  proxy_port: proxy_port # The port on which to connect to the above proxy.
  proxy_user: proxy_user # The user name to use for authentication with the proxy.
  proxy_pass: proxy_pass # The password to use for authentication with the proxy.
)

如果有帮助,请告诉我。