Ruby on Rails 中的 SSL 错误 OmniAuth

发布于 2024-12-26 12:25:24 字数 501 浏览 4 评论 0原文

我已经阅读了很多有关此错误的内容,尤其是在 OmniAuth for Rails 3 中。我有几个问题,因为目前我陷入了困境。

这篇文章中的共识< /a> 是它无法正确引用证书。我的第一个问题是(我使用 Windows 7 来回答这个问题):

我应该在硬盘驱动器的哪个位置开始寻找证书?我使用 RailsInstaller 来安装 Rails 3,我能找到的唯一靠近该位置的东西是在“Git”中,其中有一个包含 ca-path 文件的“cert”目录。然而,大多数人拥有的参考是“/etc/certs/”或其他东西(基本上是相对网址)。我的问题是引用它的父目录在哪里?这可能非常简单,但我就是不知道。它是 C:/ 目录中我的 RailsInstaller 文件夹吗?

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.

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):

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

傻比既视感 2025-01-02 12:25:24

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

文件 cacert.pem 中,来自 http://curl.haxx.se/ca / 放入您的 Rails 应用程序配置目录,

感谢以下帖子:

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

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

thanks to this posts:

山色无中 2025-01-02 12:25:24

您好,Vivek,我在 Windows 7 上解决了这个问题,
您可以从这里获取证书:
https://gist.github.com/fnichol/867550

因此该证书的位置将是< strong>C:\RailsInstaller\cacert.pem

完整映像:config\initializers\omniauth.rb

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, '4545454545fgdfg','545fg45fdh4f5d4gh5fd4h5fd4h5fd4h',
  {:scope => '', :client_options => { :ssl => { :ca_file => 'C:\RailsInstaller\cacert.pem'}}} 
end

Hi Vivek I resolve this issue on windows 7,
you can get certificate from here:
https://gist.github.com/fnichol/867550

So location for this certificate will be C:\RailsInstaller\cacert.pem

Full image: config\initializers\omniauth.rb

OmniAuth.config.logger = Rails.logger

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, '4545454545fgdfg','545fg45fdh4f5d4gh5fd4h5fd4h5fd4h',
  {:scope => '', :client_options => { :ssl => { :ca_file => 'C:\RailsInstaller\cacert.pem'}}} 
end
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文