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

请建议. .


当前回答

我在开发Ruby项目时遇到了同样的问题。我使用的是64bit的Windows 7。

我是这样解决的:

下载cacert。来自http://curl.haxx.se/ca/cacert.pem的Pem文件。 保存到C:/RubyCertificates/cacert.pem目录下 然后设置我的环境变量“SSL_CERT_FILE”为“C:\RubyCertificates\cacert.pem”

来源:https://gist.github.com/fnichol/867550

其他回答

添加gem 'certified', '~> 1.0'到我的Gemfile和运行bundle解决了我的这个问题。

我不得不重新安装Ruby。如果你使用Ubuntu & rbenv,这应该可以解决这个问题:

rbenv uninstall your_version

# install dependencies
sudo apt-get install autoconf bison build-essential libssl-dev libyaml-dev libreadline6-dev zlib1g-dev libncurses5-dev libffi-dev libgdbm3 libgdbm-dev

# install ruby with patch
curl -fsSL https://gist.github.com/mislav/055441129184a1512bb5.txt | \
  rbenv install --patch your_version

有关更多信息,请查看rbenv Wiki。

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.

只是因为对我有用的说明略有不同,我想我补充一下我的意见:

我在OS X Lion和使用macports和rvm

我安装了curl-ca-bundle:

sudo port install curl-ca-bundle

然后我调整了我的omniauth配置如下:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :google_oauth2, APP_CONFIG['CONSUMER_KEY'], APP_CONFIG['CONSUMER_SECRET'],
           :scope => 'https://www.google.com/m8/feeds https://www.googleapis.com/auth/userinfo.profile',
           :ssl => {:ca_path => "/share/curl/curl-ca-bundle.crt"}
end

我在开发Ruby项目时遇到了同样的问题。我使用的是64bit的Windows 7。

我是这样解决的:

下载cacert。来自http://curl.haxx.se/ca/cacert.pem的Pem文件。 保存到C:/RubyCertificates/cacert.pem目录下 然后设置我的环境变量“SSL_CERT_FILE”为“C:\RubyCertificates\cacert.pem”

来源:https://gist.github.com/fnichol/867550