google-api-ruby-client: Receive "certificate verify failed" when running client.authorization.fetch_access_token! on Mac
I’m on Mac OS X Yosemite 10.10.3
The full error message is:
Faraday::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from ruby/2.2.0/net/http.rb:923:in `connect'
Things I’ve tried:
- Updating to the latest google-api-client (0.8.6)
- Updating OpenSSL using homebrew and force relinking it (stable 1.0.2a-1)
- Running
rvm osx-ssl-certs update all
- Checking that
rvm osx-ssl-certs status all
says “Up to date” for all pem files (it does) - Downloading a new pem file from
curl.haxx.se/ca/cacert.pem
and then using the ca_file option to reference that pem file - Out of desperation, I tried running
client.connection.ssl.verify = false
but this still doesn’t work. Perhaps faraday is initialized prior to me running this, and so ignores it?
I’ve read a ton of stack overflows, searched forums, searched issues on the project. Everything I try still results in a “certificate verify failed” when running fetch_access_token!
This error does not occur when I use an existing oauth2 access_token and make an API request.
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 30 (2 by maintainers)
@fletchrichman Same here it seems to be a Yosemite problem, solved by downloading this http://curl.haxx.se/ca/cacert.pem, and saving it replacing
/usr/local/etc/openssl/cert.pem
. I’ve addedexport SSL_CERT_FILE=/usr/local/etc/openssl/cert.pem
to my.bash_profile
.I can confirm this issue. I’ve tried all of the above as well.
I’ve worked around this by explicitly loading openssl first (in my case before Bundler.require) and setting verify to none:
This is not a good idea, but I haven’t found a real fix yet.
I have this problem today and fix reinstalling ruby using
rvm reinstall ruby-2.1.5 --with-openssl-dir=/usr/local
I am on
yosemite
, I had to do:http://railsapps.github.io/openssl-certificate-verify-failed.html, looks like outdated to me because,
curl-ca-bundle
is no more availabe as brew formula neither didraggi/ale
worked for me.gem install rake -v '10.5.0'
beforebundle install
works for me! Thanks!Yeah, don’t do that 😃
Just pushed a new version of signet (0.6.1) which hopefully fixes this. Other workarounds:
@dblommesteijn Replacing cert.pem file solution works on OS X El Capitan 10.11.6 as well
I’m also having this problem on Windows.
Update: Solved by updating RubyGems (from
2.5.1
to2.6.7
)Had this issue too, had all the same issues as @spikex and had to download the cert file from lib/cacerts.pem and replace my local one. apparently this is the only valid cert file, not the ones from brew or rvm.