Ruby on Rails中的SSL错误OmniAuth

编程入门 行业动态 更新时间:2024-10-28 17:23:25
本文介绍了Ruby on Rails中的SSL错误OmniAuth的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我已经读到了很多有关此错误的信息,尤其是在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

本文发布于:2023-10-27 06:41:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1532611.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   Rails   Ruby   OmniAuth   SSL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!