我使用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'

请建议. .


当前回答

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

宝石“认证” 包安装

其他回答

这招对我很管用

rvm pkg install openssl
rvm reinstall 1.9.2 --with-openssl-dir=$rvm_path/usr

我的ubuntu 12.04的openssl实现有问题

如果你在/usr/local/etc/openssl中有一个指向cert.pem的符号链接,尝试这样做:

ruby -ropenssl -e "p OpenSSL::X509::DEFAULT_CERT_FILE" (should be /usr/local/etc/openssl)
cd /usr/local/etc/openssl
wget http://curl.haxx.se/ca/cacert.pem
ln -s cacert.pem 77ee3751.0 (77ee3751.0 is my symbolic link, should depend on the openssl version)

你在OSX上得到这个错误的原因是rvm安装的ruby。

如果你在OSX上遇到这个问题,你可以在这篇博客文章中找到一个真正广泛的解释:

http://toadle.me/2015/04/16/fixing-failing-ssl-verification-with-rvm.html

简而言之,对于某些版本的Ruby, RVM会下载预编译的二进制文件,这会在错误的位置查找证书。通过强制RVM下载源代码并在您自己的机器上编译,可以确保证书位置的配置是正确的。

这样做的命令是:

rvm install 2.2.0 --disable-binary

如果您已经有问题的版本,您可以重新安装它:

rvm reinstall 2.2.0 --disable-binary

(显然,根据需要替换ruby版本)。

如果您在Leopard上有特别的问题,以下是我所做的帮助。

我的证书已经旧了,需要更新。我下载了这个:

http://curl.haxx.se/ca/cacert.pem

然后替换了我在Leopard上找到的证书

/usr/share/curl/curl-ca-bundle.crt

重新加载正在访问它的任何东西,你应该很好!

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

# 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