5

In development mode, during the authentication callback phase from localhost/auth/facebook, I am faced with the following error

OAuth2::Error : {"access_token":"XXX","token_type":"bearer","expires_in":123}

This is the location of the error

enter image description here

This is the stack trace

oauth2 (0.9.4) lib/oauth2/client.rb:140:in `get_token'
oauth2 (0.9.4) lib/oauth2/strategy/auth_code.rb:29:in `get_token'
omniauth-oauth2 (1.1.2) lib/omniauth/strategies/oauth2.rb:93:in `build_access_token'
omniauth-facebook (1.6.0) lib/omniauth/strategies/facebook.rb:145:in `block in build_access_token'
omniauth-facebook (1.6.0) lib/omniauth/strategies/facebook.rb:171:in `with_authorization_code!'
omniauth-facebook (1.6.0) lib/omniauth/strategies/facebook.rb:145:in `build_access_token'
omniauth-oauth2 (1.1.2) lib/omniauth/strategies/oauth2.rb:75:in `callback_phase'
omniauth-facebook (1.6.0) lib/omniauth/strategies/facebook.rb:71:in `callback_phase'
omniauth (1.4.2) lib/omniauth/strategy.rb:227:in `callback_call'
omniauth (1.4.2) lib/omniauth/strategy.rb:184:in `call!'
omniauth (1.4.2) lib/omniauth/strategy.rb:164:in `call'

I am using the following gem versions

  • oauth (0.5.1)
  • oauth2 (0.9.4)
  • omniauth (1.4.2)
  • omniauth-facebook (1.6.0)

I suspect it is an issue with the gems not being compatible with data being sent back by Facebook.

Any pointers on how to go about this challenge?

Update: Adding image of the error for Deepak

enter image description here

chickensmitten
  • 477
  • 6
  • 16
  • What is the error? Please add the error as well – Deepak Mahakale Apr 12 '17 at 09:20
  • Hello deepak, my apologies, I am not fully understand your question properly, as I believe I have shared the error in the first few lines. Regardless, I have added a screenshot of the error. – chickensmitten Apr 12 '17 at 09:22
  • 1
    The access token return format has changed, see http://stackoverflow.com/questions/42994019/facebook-graph-api-not-work-from-2-2-to-2-3 Pretty sure I saw a question about that and owin here in the last couple of days, too, and that the person there fixed it by updating their packages. – CBroe Apr 12 '17 at 11:09

1 Answers1

5

You might be using older gem version. It might be a good idea to update the versions if that is feasible for your application. Also, check that in your environment you are able to talk to Facebook and there are no proxy issues.

anshu.gupta
  • 109
  • 1
  • 6
  • yes, the update is the answer. But it didnt work because I was also using omniauth-soundcloud which depends on an earlier version of oauth2 (omniauth-soundcloud last commit was 5 years ago). so there is a dependency conflict there. I had to fork omniauth-soundcloud and update the gems as suggested in this link http://stackoverflow.com/questions/6132479/2-gems-need-different-versions-of-the-same-dependency, then only I can bundle update with no issues. – chickensmitten Apr 13 '17 at 02:24