我正在嘗試爲AuthLogic與Facebook一起實施OmniAuth。目前,我發現了以下錯誤:rails 3 omniauth SSL錯誤
所以SSL_connect返回= 1個錯誤號= 0狀態= SSLv3的讀取服務器證書B:證書驗證失敗
我已經試過這裏顯示的解決方案:SSL Error OmniAuth in Ruby on Rails,但沒有成功。嘗試啓動我的服務器時,出現錯誤(未定義的局部變量或方法`config')。我在一臺Windows機器上下載了cacert.pem文件並將其放在/ config /文件夾中。
下面是我在我的/initialzers/omniauth.rb文件中的代碼:
Rails.application.config.middleware.use OmniAuth::Builder do
require "omniauth-facebook"
if RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
ca_file = File.expand_path Rails.root.join("config", "cacert.pem")
ssl_options = {}
ssl_options[:ca_path] = '/etc/ssl/certs' if Rails.env.staging?
ssl_options[:ca_file] = ca_file
config.omniauth :facebook, "MYAPPID", "MYAPPSECRET", # "APP_ID", "APP_SECRET" your got from facebook app registration
:client_options => {:ssl => ssl_options}
else
config.omniauth :facebook, "MYAPPID", "MYAPPSECRET"
end
end
我也看到了帖子引用CA-certificate.crt代替cacert.pem,其中哪些是找對於?我有點迷失在接下來的嘗試,所以任何幫助非常感謝!