Diego81 / omnicontacts

A generalized Rack middleware for importing contacts from major email providers.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

An active access token must be used to query information about the current user - Facebook

aruprakshit opened this issue · comments

routes.rb

get "/contacts/facebook/callback" => "omni_auth_contacts#facebook", as: :fb_contacts
get '/contacts/failure' => 'omni_auth_contacts#failure'

omni_auth_contacts_controller.rb

class OmniAuthContactsController < ApplicationController
  before_action :authenticate_user!

  def facebook
    @contacts = request.env['omnicontacts.contacts']
    @user = request.env['omnicontacts.user']
  end

  def failure
    redirect_to edit_user_registration_path, notice: params['error_message']
  end
end

Now when I am clicking the facebook contact link '/contacts/facebook' , I authorized the app by logging into Facebook and then getting below error:

2017-05-06T20:14:40.980263+00:00 app[web.1]: I, [2017-05-06T20:14:40.980162 #7]  INFO -- : [09fa7dfe-7fe2-4b00-bec3-04ba5d88e8b2] Started GET "/contacts/facebook/callback?code=X2E5xym2LVK-5cT-Q1EmfW-VmTvsPFmaUUbZDvQDusZZtWytthoLbMyjdNDX9y-ICni5L9hceC0X_5qbO6YU4WGi3jDyiYep1RFebMFjRu_4rB6V-YEJ6AHykOD-6lgpCP_oBRhHJ0SbJjlchBRGxUNanTex_XRRSI8gaboGJ" for 162.158.165.151 at 2017-05-06 20:14:40 +0000
2017-05-06T20:14:41.044274+00:00 app[web.1]: Error internal_error while processing /contacts/facebook/callback: {"error":{"message":"An active access token must be used to query information about the current user.","type":"OAuthException","code":2500,"fbtrace_id":"CKHMrNvCzYQ"}}
2017-05-06T20:14:41.045815+00:00 heroku[router]: at=info method=GET path="/contacts/facebook/callback?code=X2E5xym2LVK-5cT-Q1EmfW-VmTvsPFmaUUbZDvQDusZZtWytthoLbMyjdNDX9y-ICni5L9hceC0X_5qbO6YU4WGi3jDyiYep1RFebMFjRu_4rB6V-YEJ6AHykOD-6lgpCP_oBRhHJ0SbJjlchBRGxUNanTex_XRRSI8gaboGJ" host=musewiz.com request_id=09fa7dfe-7fe2-4b00-bec3-04ba5d88e8b2 fwd="182.66.123.153,182.66.123.153,162.158.165.151" dyno=web.1 connect=0ms service=67ms status=302 bytes=874 protocol=https
2017-05-06T20:14:41.396922+00:00 heroku[router]: at=info method=GET path="/contacts/failure?error_message=internal_error&importer=facebook" host=musewiz.com request_id=bb030a49-1e6c-47b8-a1a1-99b3533ee2eb fwd="182.66.123.153,182.66.123.153,162.158.165.151" dyno=web.1 connect=0ms service=14ms status=500 bytes=2854 protocol=https
2017-05-06T20:14:41.384503+00:00 app[web.1]: I, [2017-05-06T20:14:41.384422 #7]  INFO -- : [bb030a49-1e6c-47b8-a1a1-99b3533ee2eb] Started GET "/contacts/failure?error_message=internal_error&importer=facebook" for 162.158.165.151 at 2017-05-06 20:14:41 +0000
2017-05-06T20:14:41.386965+00:00 app[web.1]: I, [2017-05-06T20:14:41.386898 #7]  INFO -- : [bb030a49-1e6c-47b8-a1a1-99b3533ee2eb] Processing by OmniAuthContactsController#failure as HTML
2017-05-06T20:14:41.387048+00:00 app[web.1]: I, [2017-05-06T20:14:41.387004 #7]  INFO -- : [bb030a49-1e6c-47b8-a1a1-99b3533ee2eb]   Parameters: {"error_message"=>"internal_error", "importer"=>"facebook"}

I'm also now getting this same error with Facebook.

same issue for me too

@lethunder @comradeHac @aruprakshit I am having the same issue, can anyone help me fix this?

not yet @tonyvince .i'm still working on it. Sorry

@tonyvince I wrote it myself. I didn't use the gem for it. Followed their API and fetched the informations I needed.