SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书validationMAC失败

我正在尝试使用SoundCloud SDK进行用户身份validation。 用户点击“登录”后的第一条路线:

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的以下错误:

在/ signed_in的OpenSSL :: SSL :: SSLError SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书validation失败

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

SSL_connect返回= 1 errno = 0状态= SSLv3读取服务器证书B:证书validation失败

其中许多人

当我输入:

 rvm osx-ssl-certs status all 

我的结果是/usr/local/etc/openssl/cert.pem的证书:最新。

我目前在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.rb看起来像这样:

     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来解决这个问题,尝试在你的Gemfile gem 'certified', '~> 1.0'