Announcing:

LessConf 2012 will be Feb 23-24 in Atlanta, Georgia!
Register today and make us smile super big!

Facebook ssl issue with Devise

written by Steven on May 09, 2011

Working on Facebook authentication integration with Devise and hit an ssl snag when fb would call the oauth callback:

OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed):

What the?!

So I found this little tidbit on stackoverflow which solved the problem. The issue is that you need to tell Devise->OmniAuth->Faraday where your cert is. Here's how to change your devise.rb initializer:

Before:
config.omniauth :facebook, 'xx', 'yy', {:scope => 'publish_stream,offline_access,email'}

After:
config.omniauth :facebook, 'xx', 'yy', {:scope => 'publish_stream,offline_access,email', :client_options => {:ssl => {:ca_file => '/etc/pki/tls/certs/ca-bundle.crt'}}}
 
I hope you'll join us for LessConf 2012, Feb 23-24, 2012 in Atlanta Ga.
We're releasing our first ebook titled "How we built our consultancy to over $1,000,000 a year in revenue." Get early access to the ebook.

Leave a Comment

About Steven
Steven Bristol has written code for the past 20 years. He like green vegetables and kittens, oh and butterflies too. He loves to throw ninja stars at his enemies.

You Should...

Follow Steven on Twitter
Friend Steven on Facebook
Subscribe
LessEverything Copyright 2011 LessEverything.com
We don't like footers, they're kinda boring