且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Ruby on Rails中的SSL错误OmniAuth

更新时间:2023-09-12 08:37:52

在我的config \ initializers \ devise.rb

In my config\initializers\devise.rb

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, "APP_ID", "APP_SECRET", # "APP_ID", "APP_SECRET" your got from facebook app registration
        :client_options => {:ssl => ssl_options}
else
    config.omniauth :facebook, "APP_ID", "APP_SECRET"
end

来自 http://curl.haxx.se/ca/

文件cacert.pem到您的Rails应用程序配置目录

file cacert.pem from http://curl.haxx.se/ca/ put to your rails app config directory

感谢这篇文章: