OAuth2 error during facebook authentication in Rails

In development mode, during the authentication callback phase from localhost / auth / facebook, I encountered 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 a 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 the problem is because the gems are not compatible with the data sent by Facebook.

Any pointers on how to solve this problem?

Update: adding error image for Deepak

enter image description here

+5
source share
1 answer

Perhaps you are using an older version of gem. It might be advisable to upgrade versions if possible for your application. Also, make sure that you can talk to Facebook in your environment and that there are no proxy issues.

+5
source

Source: https://habr.com/ru/post/1266630/


All Articles