SSL_connect SYSCALL返回= 5 errno = 0 state = SSLv2 / v3读取服务器hello A – Faraday :: Error :: ConnectionFailed
我在这里看到了许多答案,但没有一个有效。
我正在使用omniauth-oauth2 gem与第三方客户集成。
我正在使用此处描述的设置阶段,但我总是收到此错误:
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 : openssl s_client -showcerts -connect partnerurl.com:443 <<<OK
有谁知道这个问题的解决方案?
我终于找到了最终答案:
感谢@mislav提供改变ssl version
的提示。
我不得不改变,因为我的伙伴使用asp.net构建了它的应用程序并使用了这个版本的ssl。 更多信息,请访问http://mislav.uniqpath.com/2013/07/ruby-openssl/
所以最终的代码如下:
Rails.application.config.middleware.use OmniAuth::Builder do client_id = 'my_client_id' client_secret = 'secret' ssl_options = {} ssl_options[:version] = :TLSv1 ssl = {} ssl[:ssl] = ssl_options provider :partner, client_id, client_secret, client_options: { connection_opts: ssl} , setup: ->(env){ req = Rack::Request.new(env) token_url = "https://#{req.params.fetch('shop')}" env['omniauth.strategy'].options[:client_options][:token_url] = token_url } end
- 使用Omniauth和Rails 3在Facebook登录时在Web和触摸界面之间切换
- OmniAuth Strategies Facebook NoAuthorizationCodeError(必须传递`code`参数或签名请求(通过`signed_request`参数):
- 如何使用Minitest测试OmniAuth的SessionsController
- 当每个请求的app id和app secret不同时,请使用omniauth-facebook?
- Rails 5设计omniauth-facebook错误:抱歉,出了点问题
- OmniAuth不适用于Rails3中的Route Globbing
- 如何在设计中使用http身份validation,并使用可选的omniauth令牌作为身份validation令牌
- 有没有人使用omniauth与rails 2.3.8?
- 获取(omniauth-facebook)和(omniauth-twitter)工作