I’m trying to implement OmniAuth for Facebook in tandem with AuthLogic. I’m currently getting the following error:
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
I’ve tried the solution shown here: SSL Error OmniAuth in Ruby on Rails with no success. I’m getting the error (undefined local variable or method `config’) when trying to start my server. I’m on a windows machine and have downloaded the cacert.pem file and placed it in the /config/ folder.
Here’s the code I have in my /initialzers/omniauth.rb file:
Rails.application.config.middleware.use OmniAuth::Builder do
require "omniauth-facebook"
if RbConfig::CONFIG["host_os"] =~ /mingw|mswin/
ca_file = File.expand_path Rails.root.join("config", "cacert.pem")
ssl_options = {}
ssl_options[:ca_path] = '/etc/ssl/certs' if Rails.env.staging?
ssl_options[:ca_file] = ca_file
config.omniauth :facebook, "MYAPPID", "MYAPPSECRET", # "APP_ID", "APP_SECRET" your got from facebook app registration
:client_options => {:ssl => ssl_options}
else
config.omniauth :facebook, "MYAPPID", "MYAPPSECRET"
end
end
I’ve also seen posts referencing ca-certificate.crt instead of cacert.pem, which of these is it looking for? I’m a little lost on what to try next so any help is greatly appreciated!
The (undefined local variable or method ‘config’) error you are getting here is because there is no ‘config’ variable defined in your file. The post you extracted it from was configuring devise which has
Devise.setup do |config| ... endblock so the variable config can be used there.
Get rid of the config variable so it would be something like this,