SSL_connect returned=1 errno=0 state=SSLv3 read server certi



我正在尝试使用SoundCloud SDK进行用户身份验证。用户点击"sign in"后的第一条路由:

get "/login" do 
    client = Soundcloud.new(:client_id => 'MY_ID',
                    :client_secret => 'MY_SECRET',
                    :redirect_uri => 'http://localhost:9393/signed_in')
redirect client.authorize_url()
end 

然后我有下一个路由,它们被重定向:

get "/signed_in" do 
client = Soundcloud.new(:client_id => '16d6ada1a0cfc5009f7d59d203a13b2f',
                    :client_secret => '845df7d44dc4e359fedc8ed5944d29a5',
                    :redirect_uri => 'http://localhost:9393/signed_in')
code = params[:code]
access_token = client.exchange_token(:code => code)
end

我可以成功地点击重定向url并返回一个代码,但是我从Sinatra收到以下错误:

OpenSSL::SSL::SSLError at/signed_inSSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

我读过这些流行文章:http://railsapps.github.io/openssl-certificate-verify-failed.html

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

在许多其他

当我输入:

rvm osx-ssl-certs status all

我的结果是/usr/local/etc/openssl/cert.

我目前在Mac 10.6.8上使用ruby 2.1.1。关于这个话题,我已经问了大约20个关于堆栈溢出的问题,但我无法跳过这个问题。

  1. 下载http://curl.haxx.se/ca/ca-bundle.crt
  2. 将证书拷贝到/usr/local/etc/openssl/certs/
  3. omniauth。

    options = {
      scope: "email",
      :prompt => "select_account",
      access_type: 'offline',
      :client_options => {
        :ssl => {
          :ca_file => "/usr/local/etc/openssl/certs/ca-bundle.crt",
          :ca_path => "/usr/local/etc/openssl/certs"
        }
      }
    }
    Rails.application.config.middleware.use OmniAuth::Builder do
      provider :google_oauth2, Rails.application.secrets.client_id, Rails.application.secrets.client_secret, options
    end
    

有一个gem来解决这个问题,尝试将gem 'certified', '~> 1.0'添加到您的Gemfile

最新更新