Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OAuth2 Error during facebook authentication in Rails

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

like image 858
chickensmitten Avatar asked Apr 12 '17 09:04

chickensmitten


1 Answers

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.

like image 187
anshu.gupta Avatar answered Oct 18 '22 01:10

anshu.gupta