D
D
Denis Savitsky2012-05-22 18:38:44
Facebook
Denis Savitsky, 2012-05-22 18:38:44

Very slow authorization through Facebook?

For some reason not yet clear, facebook responds very slowly: cl.ly/Gou0 .
I'm using OmniAuth, the code looks like this:

class AuthenticationsController < ApplicationController
...
  def create
    auth = auth_hash

    if current_user
      # If logged in, then try to add an authentication
      current_user.authentications.find_or_create_by_provider_and_uid_and_auth_token(auth['provider'], auth['uid'], auth['credentials']['token'])

    else
      # If not logged in, check, if has been logged in earlier
      authentication = Authentication.find_by_provider_and_uid(auth['provider'], auth['uid'])

      if authentication.nil?
        #  If not, create User
        u = User.create_with_omniauth(auth)
        u.authentications.create!(provider: auth['provider'], uid: auth['uid'], auth_token: auth['credentials']['token'])

      else
        # Else log in with existing user
        u = User.find(authentication.user_id)
      end

      session[:user_id] = u.id
      dependent_respond
    end
  end
end

Where am I wrong?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
andreysmind, 2012-05-23
@andreysmind

did not encounter. the truth at me authentication is checked through signed_request.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question