【发布时间】:2014-04-22 15:22:30
【问题描述】:
我在这里看到了很多答案,但没有一个有效。
我正在使用omniauth-oauth2 gem 与第三方客户集成。
我正在使用here 描述的设置阶段,但我总是收到此错误:
Authentication failure! failed_to_connect: Faraday::Error::ConnectionFailed, SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A
Faraday::Error::ConnectionFailed (SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A):
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `connect'
.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/net/http.rb:918:in `block in connect'
我在config/initializers 的初始化程序是:
Rails.application.config.middleware.use OmniAuth::Builder do
client_id = 'my_client_id'
client_secret = 'secret'
ca_file = Rails.root.join('config', 'cacert.pem').to_s
ssl_options = {}
ssl_options[:ca_path] = '/usr/local/etc/openssl'
ssl_options[:ca_file] = ca_file
provider :my_partner_provider, client_id, client_secret, :client_options => {:ssl => ssl_options},
setup: ->(env){
req = Rack::Request.new(env)
site = "https://#{req.params.fetch('shop')}"
env['omniauth.strategy'].options[:client_options][:site] = site
}
end
我尝试过使用和不使用 ssl 选项。
作为补充,这是我的堆栈:https://gist.github.com/cleytonmessias/11274209
我在终端输入了openssl s_client -showcerts -connect partnerurl.com:443 <<<OK,它返回了这个:https://gist.github.com/cleytonmessias/11288646
有人知道这个问题的解决方法吗?
【问题讨论】:
-
你找到解决办法了吗?
-
我会说这是一个错误,但它可能不是来自 Net::HTTP。我在连接到 Sharepoint 服务时遇到了这个问题:wget 也无法连接,而 curl 完全没有问题。
-
但是你解决了吗?我仍然没有找到任何东西。
-
您使用的是什么 OpenSSL 版本?是系统一还是 RVM 自带的?
-
明确设置
ssl_version有帮助吗? stackoverflow.com/a/9262269
标签: ruby-on-rails ruby omniauth