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

请建议. .


当前回答

这对我很管用。如果你使用rvm和brew:

rvm remove 1.9.3
brew install openssl
rvm install 1.9.3 --with-openssl-dir=`brew --prefix openssl`

其他回答

一行程序在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]

如果您在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

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

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

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