Search code examples
ruby-on-railsfacebookdeviseomniauth

FB Connect with Devise + Omniauth get error: hostname was not match with the server certificate


I'm running into a problem, where I keep getting this error after entering my Facebook username/password.

OpenSSL::SSL::SSLError

hostname was not match with the server certificate"

I'm on Mac 10.6.6, Ruby 1.9.2-p180, Rails 3.0.7 with XCode installed, using Devise and Omniauth to do this Facebook connect.

How can I get this over with?


Solution

  • Answer on my own, it may help others who have the same issue:

    This error is because of SSL Certification checking. I followed some online tutorials to create cert files on Mac OS but it took too much time so finally I decided to bypass the SSL checking on development machine by adding these lines to ./config/initializers/devise.rb:

    if Rails.env.development? 
      OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE 
    end