Omniauth Facebook Error - Faraday::Error::Connecti

2020-01-25 13:12发布

(FYI: I'm following the Twitter Omniauth from railscast #241. I used Twitter successfully, now going onto Facebook)

As soon as I logged into Facebook using Omniauth, I get this error:

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

What does this mean?

This is my code

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook, '<key from fb>', '<another key from fb>'
end

There's actually nothing much in my code, all I have is in the sessionController that I want to use to_yaml to see what's inside the request.env

class SessionsController < ApplicationController
    def create
        raise request.env["omniauth.auth"].to_yaml
    end
end

How do I solve the Faraday error?

9条回答
ら.Afraid
2楼-- · 2020-01-25 13:56

Andrei's answer didn't work for me on Mac OSX 10.8.3. I had reinstalled openssl to install ruby 2.0 some time ago and since then always got this error. I fixed it thanks to Andrei's answer and instructions from the Rails project.

I ran:

$ rvm -v
$ rvm get head
# Installation of latest version of rvm...
$ rvm -v
# rvm 1.19.5 (master)
$ rvm osx-ssl-certs status all
# Certificates for /usr/local/etc/openssl/cert.pem: Old.
# Certificates for /Users/mpapis/.sm/pkg/versions/openssl/0.9.8x/ssl/cert.pem: Old.
$ sudo rvm osx-ssl-certs update all
# Updating certificates...

Then I checked if the certificates were correctly updated by running rvm osx-ssl-certs status all again but /usr/local/etc/openssl/cert.pem was still not updated. I don't know if that was necessary but I did the following:

$ cd /usr/local/etc/openssl/
$ curl -O http://curl.haxx.se/ca/cacert.pem
$ mv cacert.pem cert.pem

After that the problem was fixed. Hope that helps someone else who runs into the same issue.

查看更多
神经病院院长
3楼-- · 2020-01-25 14:03

The RVM website suggests running rvm osx-ssl-certs update all

RVM Website: How to fix broken certificates in your operating system.

查看更多
虎瘦雄心在
4楼-- · 2020-01-25 14:05

Alternative Solution:

[I am Win7 user with manual install the Ruby and Ruby on Rails]

I have the same problem but cannot resolve by the answer that given by this question. By the way, finally, I got problem solved by following url

Facebook Redirect url in ruby on rails open ssl error https://github.com/technoweenie/faraday/wiki/Setting-up-SSL-certificates

查看更多
登录 后发表回答