四方& Heroku:证书验证失败
我在 foursquare 开发者网站上获得了用于无用户访问的密钥/秘密,现在我想使用 foursquare2 gem 来获取数据:
@foursquare = Foursquare2::Client.new(:client_id => 'xxx', :client_secret => 'yyy')
这在 localhost 上运行良好,但在 Heroku 上出现以下错误:
ActionView::Template::Error (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed)
我没有在应用程序中设置任何 SSL 或 Omniauth。
更新:找到解决方案!您必须传入 ssl 哈希以及 heroku 证书路径的路径。
@foursquare = Foursquare2::Client.new(:client_id => 'xxx',
:client_secret => 'yyy',
:ssl => { :verify => OpenSSL::SSL::VERIFY_PEER, :ca_file => '/usr/lib/ssl/certs/ca-certificates.crt' })
I obtained a key/secret for userless access at the foursquare developer site and now I want to fetch data with the use of the foursquare2
gem:
@foursquare = Foursquare2::Client.new(:client_id => 'xxx', :client_secret => 'yyy')
This works fine on localhost but on Heroku I get the following error:
ActionView::Template::Error (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed)
I didn't set up any SSL or Omniauth within the app.
Update: Found the solution! You have to pass in a ssl hash with the path to heroku's certificates path.
@foursquare = Foursquare2::Client.new(:client_id => 'xxx',
:client_secret => 'yyy',
:ssl => { :verify => OpenSSL::SSL::VERIFY_PEER, :ca_file => '/usr/lib/ssl/certs/ca-certificates.crt' })
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我也在 ruby 1.9.3 下提到过这个问题。降级到 ruby 1.9.2 后,我不再收到该错误......
I also mentioned that problem under ruby 1.9.3. After downgrading to ruby 1.9.2 I didn't get that error anymore...