Announcing:

LessMoney Conference will be June 7th in Tampa! 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'}}}
 
Learn how LessEverything built their consultancy to over $1,000,000 annual revenue at LessMoney Conference, June 7th in Tampa Florida. Each attendee will get early access to our upcoming ebook as well.

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