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

请建议. .


当前回答

我试着用brew安装curl-ca-bundle,但这个包已经没有可用的了:

$ brew install curl-ca-bundle
Error: No available formula for curl-ca-bundle 
Searching formulae...
Searching taps...

对我来说,Mac上的解决方案是:

 $ cd /usr/local/etc/openssl/certs/
 $ sudo curl -O http://curl.haxx.se/ca/cacert.pem

在~/中添加这一行。Bash_profile(或~/.)ZSHRC for zsh):

export SSL_CERT_FILE=/usr/local/etc/openssl/certs/cacert.pem

然后更新你的终端:

$ source ~/.bash_profile

其他回答

然后,正如这篇博客文章所建议的,

“如何治愈Net::HTTP的风险默认HTTPS行为”

您可能需要安装always_verify_ssl_certificates gem,该gem允许您为ca_file设置默认值。

以下是如何在Windows上修复它:https://gist.github.com/867550(由Fletcher Nichol创建)

摘录:

手工方式(无聊) 下载cacert。来自http://curl.haxx.se/ca/cacert.pem的Pem文件。将文件保存到C:\RailsInstaller\cacert.pem。 现在,通过设置SSL_CERT_FILE,让ruby知道您的证书颁发机构包。要在当前命令提示符会话中设置此选项,输入: 设置SSL_CERT_FILE = C: \ RailsInstaller \ cacert.pem 要使此设置为永久设置,请在控制面板中添加此设置。

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

1.brew update
2.brew install openssl

我试着用brew安装curl-ca-bundle,但这个包已经没有可用的了:

$ brew install curl-ca-bundle
Error: No available formula for curl-ca-bundle 
Searching formulae...
Searching taps...

对我来说,Mac上的解决方案是:

 $ cd /usr/local/etc/openssl/certs/
 $ sudo curl -O http://curl.haxx.se/ca/cacert.pem

在~/中添加这一行。Bash_profile(或~/.)ZSHRC for zsh):

export SSL_CERT_FILE=/usr/local/etc/openssl/certs/cacert.pem

然后更新你的终端:

$ source ~/.bash_profile

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.