我已经读到了很多有关此错误的信息,尤其是在OmniAuth for Rails 3中.我有几个问题,因为当前我被卡在它上面.
I've read a lot about this error especially in OmniAuth for Rails 3. I have a few questions because currently I'm stuck on it.
中的共识> 的帖子是它无法正确引用证书.我的第一个问题是这个(我正在使用Windows 7作为问题的开头):
The consensus in this post was that it couldn't reference the certs properly. My first question is this (I'm using Windows 7 to preface the question):
我将开始在硬盘驱动器的确切位置找到证书吗?我使用RailsInstaller来安装Rails 3,并且我能找到的唯一靠近该位置的地方是"Git"中,其中有一个带有ca-path文件的"cert"目录.但是,大多数人的参考是这个"/etc/certs/"之类的东西(基本上是一个相对的URL).我的问题是在哪里引用父目录?这可能非常简单,但我不知道.是我在C:/目录中的RailsInstaller文件夹吗?
Where exactly in my hard drive would I begin to look to find the certs? I used RailsInstaller to install Rails 3 and the only thing that I can find that is close to that location is in "Git" where there is a "cert" directory with the ca-path file. However, the reference that most people have is this "/etc/certs/" or something (basically a relative url). My question is where is the parent directory from which this is referenced? It may be extremely simple but I just don't know. Would it be my RailsInstaller folder in the C:/ directory?
推荐答案在我的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来自 curl.haxx.se/ca/的
文件cacert.pem到您的Rails应用程序配置目录
file cacert.pem from curl.haxx.se/ca/ put to your rails app config directory
感谢这篇文章:
-
为什么在Windows上使用Mechanize访问SSL站点会失败,而在Mac上却能正常工作?
grokbase/p/gg/rubyonrails-talk/121bfxzwke/rails-re-windows-rails-3-1-3-omniauth-browserid-ssl-erro
更多推荐
Ruby on Rails中的SSL错误OmniAuth
发布评论