0

消费者令牌哈希在我的代码中定义

access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
url = URI.encode("https://api.twitter.com/1.1/statuses/update.json?status=awesome!")
response = access_token.request(:post, url)

它给了我们

OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
    from /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
    from /usr/lib/ruby/1.8/net/http.rb:586:in `connect'
    from /usr/lib/ruby/1.8/net/http.rb:553:in `do_start'
    from /usr/lib/ruby/1.8/net/http.rb:542:in `start'
    from /usr/lib/ruby/1.8/net/http.rb:1035:in `__request__'
    from /usr/lib/ruby/gems/1.8/gems/rest-client-1.6.7/lib/restclient/net_http_ext.rb:51:in `request'
    from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:161:in `request'
    from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/tokens/consumer_token.rb:25:in `request'
    from /usr/lib/ruby/gems/1.8/gems/oauth-0.4.7/lib/oauth/tokens/access_token.rb:12:in `request'

请帮我

4

2 回答 2

1

使用最新的 RVM(Ruby 版本管理器)通过使用 Ruby on Rail 框架修复第三方应用程序集成。

有关更多信息,请在此处使用分步指南 - OpenSSL 错误和 Rails 证书验证失败

希望能帮助到你!

于 2013-07-26T12:32:25.203 回答
0

我有同样的错误。我仍然无法解决潜在问题,但尝试将其粘贴到您的 .rb 文件中。

OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

它基本上关闭了验证步骤。

于 2013-07-26T11:42:43.807 回答