I am using devise and omniauth for authentication. Wherever i click on
the facebook login button i get this warning msg.
******************************************
warning: peer certificate won't be verified in this SSL session
******************************************
But now i get this error msg

*****************************************
OpenSSL::SSL::SSLError SSL_connect returned=1 errno=0 state=SSLv3 read
server certificate B: certificate verify failed
****************************************

What am i doing wrong?

--------------
Routes.rb
--------------
 get "/auth/:provider/callback" => "authentications#create"
----------------------------------------

In my config/initializers/omniauth.rb
-----------------------------------------
Rails.application.config.middleware.use OmniAuth::Builder do
  provider :twitter, 'xxxx', 'xxxx'
  provider :facebook, 'appid', 'appsecret',
{:scope=>'publish_stream,email'}
end
-------------------------------------

In my authentications controller
-------------------------------------
 def create

      omniauth = request.env["omniauth.auth"]

      #search if user has been authenticated and application has been
authorised
      authenticate =
Authentication.find_by_provider_and_uid(params['provider'],
omniauth['uid'])

      #if user has signed in with that provider before, sign user in and
show the requested page
      if authenticate
    sign_in_and_redirect(:user, authenticate.user)
          flash[:notice] = "Authentication successful!!"
      #create new user
      else

    user = User.new
    user.apply_omniauth(omniauth)

    case omniauth['provider']
      when 'facebook'
        if user.save
          user.profile = Profile.new

    user.profile.picture_url =
"https://graph.facebook.com/"+omniauth['uid']+"/picture"
#     user.profile.location =
omniauth['extra']['user_hash']['location']['name']
#     user.profile.gender = omniauth['extra']['user_hash']['gender']



    #save users profile
    if user.profile.save
      flash[:notice] = "Signed in with "+omniauth['provider']

      #sign user in
      sign_in_and_redirect(:user, user)
    end
        else
    redirect_to root_url, :notice => "Authentication failed, please try
again!"
        end

      when 'twitter'
        session[:omniauth] = omniauth.except('extra')
        redirect_to "#{root_url}confirm-email"
      end
     end   #close of if statement
  end #close of method
----------------------------------------
In models/user
---------------------------------------

def apply_omniauth(omniauth)

    case omniauth['provider']
      when 'facebook'
  self.email = omniauth['user_info']['email']
    end

    self.username = omniauth['user_info']['nickname'] if username.blank?
    self.name = omniauth['user_info']['name'] if name.blank?

    authentications.build(:provider=>omniauth['provider'],
:uid=>omniauth['uid'], :token =>(omniauth['credentials']['token'] rescue
nil))

  end

-------------------------------

Please is there anything am doing wrong. Because it was working
perfectly locally and even on my heroku host until it started giving me
this error message

-- 
Posted via http://www.ruby-forum.com/.

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to