1

I get this error:

OpenSSL::SSL::SSLError

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

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/cacert.pem"}}}
end

The action:

def callback
  session['fb_auth'] = request.env['omniauth.auth']
  session['fb_token'] = session['fb_auth']['credentials']['token']
  session['fb_error'] = nil
render :text => request.env['omniauth.auth'].to_yaml  
end

I have been trying some solutions to this problem like:

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:verify => false}}}
end

and

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/ca-bundle.crt"}}}
end

Where ca-bundle is: http://certifie.com/ca-bundle/ca-bundle.crt.txt

Rails.application.config.middleware.use OmniAuth::Builder do  
  provider :facebook, 'MY_APPID', 'SECRET', {:scope => 'publish_stream,email', :client_options => {:ssl => {:ca_path => "#{Rails.root}/config/cacert.pem"}}}
end

Where cacert.pem is: http://curl.haxx.se/ca/cacert.pem

I am using Windows 7. Does anybody have a solution on this or I am doing something wrong. What is the differens between .pem and .crt?

Rails beginner
  • 14,321
  • 35
  • 137
  • 257
  • Hey, have your problem got solved? If yes, accept the correct answer. If there is no correct answer, add your answer which got it solved so that everyone can get benefit from it. – RAJ Jul 16 '15 at 10:43
  • The question is like 3 years old, can´t remember if I got an answer i could use. Properly not else I would have accepted it. – Rails beginner Jul 18 '15 at 19:34

1 Answers1

1

Ruby cannot find any root certificates.

Here is another option for debugging purposes:

require 'openssl'
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE

Source: https://stackoverflow.com/a/12032944/1047207 (My answer to similar question)

You may want to take a look at this Blog also.

Community
  • 1
  • 1
RAJ
  • 9,697
  • 1
  • 33
  • 63