0

I've seen questions similar to this one but the suggested solution didnt seem to work.

I'm trying to perform oauth, using oauth2, when im trying to get the access_token, I get the following error:

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

I'm using:

rails 2.3.11
faraday 0.8.1
oauth2 0.8.0

and I'm running on Windows 7.

Any ideas?

Ran
  • 3,455
  • 12
  • 47
  • 60

2 Answers2

1

put this in development.rb

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

This will solve your issues.

KensoDev
  • 3,285
  • 21
  • 38
  • Avi, while this will make the error go away, this is *NOT* a solution. In fact, this is a terrible piece of advice. This will render the whole SSL pointless. The proper way is to use a proper certificate bundle. For example: http://stackoverflow.com/questions/9199660/why-is-ruby-unable-to-verify-an-ssl-certificate – Roman Aug 08 '12 at 18:21
  • This is definitely not a production solution, this is a solution for development only and I would not say this is ANY sort of solution if the guy was not using windows. it's a dev machine and it's windows 7. – KensoDev Aug 08 '12 at 19:40
1

The proper solution would be to initialize the OAuth::Client with a proper certificate bundle (it can be taken from a curl distribution, for instance).

client = OAuth2::Client.new(client_id, client_secret, ssl: {ca_file: "/path/to/ca-bundle.crt"})
Roman
  • 13,100
  • 2
  • 47
  • 63