我使用Authlogic-Connect第三方登录。在运行适当的迁移后,Twitter/谷歌/yahoo登录似乎工作正常,但facebook登录抛出异常:

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

开发日志显示

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):
  app/controllers/users_controller.rb:37:in `update'

请建议. .


当前回答

OSX的解决方案:

安装最新的RVM稳定版本

rvm get stable

使用RVM命令自动解析证书

rvm osx-ssl-certs update all

其他回答

Ruby找不到任何可以信任的根证书。

看看这篇博客文章的解决方案:“Ruby 1.9和SSL错误”。

解决方案是安装curl-ca-bundle端口,其中包含Firefox使用的相同根证书: Sudo端口安装curl-ca-bundle 并告诉你的HTTPS对象使用它: https。Ca_file = '/opt/local/share/curl/curl-ca-bundle.crt' 注意,如果你想让你的代码在Ubuntu上运行,你需要设置ca_path属性,使用默认的证书位置/etc/ssl/certs.

然后,正如这篇博客文章所建议的,

“如何治愈Net::HTTP的风险默认HTTPS行为”

您可能需要安装always_verify_ssl_certificates gem,该gem允许您为ca_file设置默认值。

在Ubuntu上安装以下包为我解决了这个问题

Sudo apt-get安装libssl-dev

对我来说,有效的答案是:

# Reinstall OpenSSL
brew update
brew remove openssl
brew install openssl
# Download CURL CA bundle
cd /usr/local/etc/openssl/certs
wget http://curl.haxx.se/ca/cacert.pem
/usr/local/opt/openssl/bin/c_rehash
# Reinstall Ruby from source
rvm reinstall 2.2.3 --disable-binary

只需在gemfile中添加gem 'certified',然后运行bundle install。

宝石“认证” 包安装