简体   繁体   English

Rails 3.2 omniauth SSL Windows

[英]rails 3.2 omniauth ssl windows

Apologies if this has been answered already, but I'm going through the posts here and can't find something that works. 抱歉,如果已经回答了这个问题,但是我正在浏览这里的帖子,找不到有效的方法。

I've got Devise working with rails for authentication, and I'm trying to integrate OmniAuth for facebook. 我已经让Devise使用rails进行身份验证,并且我正在尝试为Facebook集成OmniAuth。 I'm getting the SSL error that has been posted about in the past. 我收到了过去发布的SSL错误。

My error: 我的错误:

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I've been through the solutions for windows and none seem to work. 我已经解决了Windows的解决方案,但似乎都无法使用。 I'm just trying to get this working in dev on a windows machine, so I'm willing to take unsecure shortcuts to get it up and running and then figure out what's necessary in production later on. 我只是想让它在Windows机器上的开发人员中工作,所以我愿意采用不安全的快捷方式来使其启动并运行,然后在以后的生产中弄清楚什么是必需的。

I'm using: 我正在使用:

rails 3.2.2
warden 1.1.1
devise 2.0.4
faraday 0.7.6
oauth2 0.5.2
omniauth 1.0.3
omniauth-oauth2 1.0.0
omniauth-facebook 1.2.0

I've tried a couple different things in omniauth.rb: 我在omniauth.rb中尝试了几种不同的方法:

omniauth.rb: omn​​iauth.rb:

    Rails.application.config.middleware.use OmniAuth::Builder do
    provider :facebook, APP_ID, APP_SECRET, {client_options: {ssl: {ca_file: Rails.root.join('lib/assets/cacert.pem').to_s}}}
    #provider :facebook, APP_ID, APP_SECRET, {:client_options => {:ssl => {:verify => false}}}
    end

The second option (commented) is supposed to suppress ssl cert checking entirely, as far as I understand it. 据我了解,第二个选项(有注释)应该完全禁止ssl证书检查。 But that doesn't work - same error. 但这不起作用-同样的错误。 With the first option, I downloaded the appropriate file and put it in by lib/assets directory, but that doesn't seem to work either. 使用第一个选项,我下载了适当的文件并将其放在lib / assets目录中,但这似乎也不起作用。

Has something changed recently with this? 最近有什么改变吗? Am I missing something obvious? 我是否缺少明显的东西?

看起来是这样做的方法: https : //gist.github.com/867550

Try following the instructions given in this link: http://jimneath.org/2011/10/19/ruby-ssl-certificate-verify-failed.html 请尝试按照此链接中提供的说明进行操作: http : //jimneath.org/2011/10/19/ruby-ssl-certificate-verify-failed.html

And you have to make this minor change in fix_ssl.rb at the end: 最后,您必须在fix_ssl.rb中进行此较小更改:

self.ca_file = Rails.root.join('lib/ca-bundle.crt').to_s

I hope this helps. 我希望这有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM