annoying openssl error - facebook graph api, authlogic, oauth2

a strange bug i encountered that doesn't seem well-documented anywhere out there on the internetz: i've been trying to get authlogic, oauth2, and facebook's graph api to all cooperate with each other.  everything works fine except i get an error after authorizing facebook:

 

OpenSSL::SSL::SSLError in UsersController#create

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

 

 

quick fix is to tell openssl to ignore certificate verification by opening /opt/local/lib/ruby/<version of ruby>/openssl/ssl.rb

change the line:

:verify_mode => OpenSSL::SSL::VERIFY_PEER

to this:

:verify_mode => OpenSSL::SSL::VERIFY_NONE

edit: another fix i found to work on rails 3 where the fix above didn't work can be found on stackoverflow.