title: OpenSSL::SSL::SSLError on Heroku
body: <p>I'm trying to authenticate a user via Facebook or Twitter, get them to fill out their information, and then click save (thus creating a user record). I'm getting an OpenSSL error on that final step -- after clicking save. This happens at the Devise RegistrationsController#create method.</p>
  
  <p>So I'm getting this error in my Rails application, hosted on Heroku:</p>
  
  <pre><code>2012-07-28T18:25:13+00:00 app[web.1]: OpenSSL::SSL::SSLError (SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed)
  </code></pre>
  
  <p>I've seen plenty of solutions, none of them work. Here are some things I've tried:</p>
  
  <p>1) Installing the <code>certified</code> gem</p>
  
  <p>2) Upgrading the Heroku gem to v2.30, pushing again</p>
  
  <p>3) This:</p>
  
  <pre><code>Rails.application.config.middleware.use OmniAuth::Builder do
    provider :twitter, TWITTER_KEY, TWITTER_SECRET, {:client_options =&gt; {:ssl =&gt; {:ca_file =&gt; "/usr/lib/ssl/certs/ca-certificates.crt"}}}
    provider :facebook, FACEBOOK_KEY, FACEBOOK_SECRET, {:scope =&gt; "publish_actions,user_location,email", :client_options =&gt; {:ssl =&gt; {:ca_file =&gt; "/usr/lib/ssl/certs/ca-certificates.crt"}}}
  end
  </code></pre>
  
  <p>It seems like one problem could be that this cert file doesn't actually exist -- I've seen it in several places, and it seems like that is the default path to the ca_cert file for Heroku, but I could be wrong.</p>
  
  <p>Oddly enough, this is happening <i>after</i> I've already authenticated via FB/Twitter, and am trying to create a user's account. Why would this be, and how can I solve/debug this? Sincerely confused.</p>
  
  <p><b>Update:</b> I added this line to the Omniauth initializer, and now it "works". Thus I've diagnosed the problem is with Omniauth. However, I'd like to still have the SSL verification... this obviously leaves a security gap.</p>
  
  <p><code>OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE</code></p>