I'm building a Rails 3 app using Devise/OmniAuth, and Koala and I'm getting the following SSL error:
OpenSSL::SSL::SSLError in Users/omniauth callbacksController#facebook
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
The code that causes this error is:
@graph = Koala::Facebook::GraphAPI.new(@token)
@friends = @graph.get_connections("me", "friends")
I am using Devise with OmniAuth to perform authentication, which works. I then take the returned facebook token, and attempt to use it with Koala as shown above. That is what causes this error.
It's probably worth noting that I was receiving the same error with Devise & OmniAuth initially. There are a few topics about this error, and I was able to solve it, by setting up my config/initialisers/devise.rb with,
config.omniauth :facebook, APPID, APPKEY, {:client_options => {:ssl => {:ca_file => "/opt/local/share/curl/curl-ca-bundle.crt"}}}
I am guessing that I need to supply a similar configuration for Koala so that it knows where to retrieve the local ca_file. I can't find any indication of how to do so in the documentation though. Any ideas on how to do this, or how to avoid the error in general?
My dev environment is OSX.
From the Koala repo https://github.com/arsduo/koala
You can set this in a Koala initializer which will set this option globally
/config/initializers/koala.rb
Koala.http_service.http_options = {
:ssl => { :ca_path => "/etc/ssl/certs" }
}
As I found on this thread you can set your options in your environment file (or in the class where you're using the gem) the following option:
Koala.http_service.ca_file = '/path/to/some/ca-certificate.crt'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With