Not getting real facebook friends

30 views Asked by At

When I test my app using test users created through the facebook developer section, facebook friends of those test users do get fetched, but not when I use a real account with real friends. Real facebook accounts are users of the facebook app because they used facebook omniauth to get registered on my website. I don't understand why this is happening. Does anyone have any experience facing this kind of an issue?

def get_facebook_friends

        if current_user.identities.where(provider: 'facebook').exists?
            #just use user' existing facebook credentials
            identity = current_user.identities.where(provider: 'facebook').first
            facebook = Koala::Facebook::API.new(identity.token)

            @ffriends = facebook.get_connections("me", "friends?fields=id,name,picture.type(large)")
            @number_of_friends = @ffriends.length
            session['ffriends'] = @ffriends
            session['number_of_friends'] = @number_of_friends


            @facebook_main_2 = "block"
            @facebook_main_1 = "none"
            binding.pry
        else
            #have user sign_in to facebook
            session['redirect_to'] = get_facebook_friends_path
            redirect_to user_facebook_omniauth_authorize_path
        end
    end
0

There are 0 answers