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

宝石“认证” 包安装

其他回答

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.

OSX的解决方案:

安装最新的RVM稳定版本

rvm get stable

使用RVM命令自动解析证书

rvm osx-ssl-certs update all

有时这并不总是rvm的问题 在MAC OSX中,如果你删除了.rvm,问题仍然存在(特别是当你从timemachine备份数据时),你可以尝试这种方式。

1.brew update
2.brew install openssl

如果你在OS X上使用RVM,你可能需要运行这个:

rvm osx-ssl-certs update all

更多信息请访问:http://rvm.io/support/fixing-broken-ssl-certificates

完整的解释如下:https://github.com/wayneeseguin/rvm/blob/master/help/osx-ssl-certs.md


更新

在Ruby 2.2上,你可能需要从源代码重新安装Ruby来解决这个问题。以下是如何(将2.2.3替换为Ruby版本):

rvm reinstall 2.2.3 --disable-binary

感谢https://stackoverflow.com/a/32363597/4353和伊恩·康纳。

这招对我很管用

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

我的ubuntu 12.04的openssl实现有问题