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

请建议. .


当前回答

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

我在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

其他回答

我通过在终端中运行这个解决了这个问题。完整的记录可以在这里找到

rvm install 2.2.0 --disable-binary

如果你在/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)

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

我在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

我在尝试为Rails 3使用JQuery生成器时遇到了类似的问题

我是这样解决的:

Get the CURL Certificate Authority (CA) bundle. You can do this with: sudo port install curl-ca-bundle [if you are using MacPorts] or just pull it down directly wget http://curl.haxx.se/ca/cacert.pem Execute the ruby code that is trying to verify the SSL certification: SSL_CERT_FILE=/opt/local/etc/certs/cacert.pem rails generate jquery:install. In your case, you want to either set this as an environment variable somewhere the server picks it up or add something like ENV['SSL_CERT_FILE'] = /path/to/your/new/cacert.pem in your environment.rb file.

您还可以将CA文件(我没有尝试过)安装到操作系统—这里有很长的说明—这应该以类似的方式工作,但我个人没有尝试过。

基本上,您遇到的问题是一些web服务正在响应针对OpenSSL无法验证的CA签名的证书。

一行程序在Admin提示符中修复了Windows的问题

巧克力安装wget(第一次见chocolatey.org)

wget http://curl.haxx.se/ca/cacert.pem -O C:\cacert.pem && setx /M SSL_CERT_FILE "C:\cacert.pem"

或者这样做:

gem sources -r https://rubygems.org/
gem sources -a http://rubygems.org/

Milanio的方法:

gem sources -r https://rubygems.org
gem sources -a http://rubygems.org 
gem update --system
gem sources -r http://rubygems.org
gem sources -a https://rubygems.org

gem install [NAME_OF_GEM]