本文介绍了SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B: 证书验证失败 MAC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 SoundCloud SDK 进行用户身份验证.用户点击登录"后我的第一条路线:

I'm attempting to use the SoundCloud SDK for user authentication. My first route after a user clicks "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

然后我有他们被重定向的下一条路线:

I then have the next route where they are redirected:

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

I can succesfully hit the redirect url and a code is passed back, but I receieve the following error from Sinatra:

OpenSSL::SSL::SSLError at/signed_inSSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败

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 返回=1 errno=0 state=SSLv3 读取服务器证书B:证书验证失败

还有很多

当我输入时:

rvm osx-ssl-certs status all

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

my result isCertificates for /usr/local/etc/openssl/cert.pem: Up to date.

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

I'm currently using ruby 2.1.1 on Mac 10.6.8. I've gone thru about 20 stack overflow questions on this topic and I'm unable to move past this issue.

推荐答案

  1. 下载http://curl.haxx.se/ca/ca-bundle.crt
  2. 将证书复制到/usr/local/etc/openssl/certs/
  3. 使omniauth.rb 看起来像这样:

  1. Download http://curl.haxx.se/ca/ca-bundle.crt
  2. Copy certificate into /usr/local/etc/openssl/certs/
  3. Make omniauth.rb look like this:

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

这篇关于SSL_connect 返回=1 errno=0 state=SSLv3 读取服务器证书 B: 证书验证失败 MAC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 16:46