SSL_connect SYSCALL returned=5 errno=0 state=SSLv2/v3 read server hello A - Faraday::Error::ConnectionFailed

前端 未结 1 1592
醉梦人生
醉梦人生 2021-02-06 01:08

I\'ve seen many answers here, but none of them has worked.

I\'m using omniauth-oauth2 gem to integrate with a third-party customer.

I\'m using the setup phase de

相关标签:
1条回答
  • 2021-02-06 01:47

    Thanks to @mislav who give the hint to change SSL version.

    I had to change this because my partner has its application built using asp.net and uses this version of SSL. More info at https://mislav.net/2013/07/ruby-openssl/

    So the final code is as follows:

    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
    
    0 讨论(0)
提交回复
热议问题