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'}}}
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
Popular Articles
Subscribe

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.
