Answer the question
In order to leave comments, you need to log in
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
Answer the question
In order to leave comments, you need to log in
did not encounter. the truth at me authentication is checked through signed_request.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question