SoapSeller / omniauth-facebook-access-token

51 stars 68 forks source link

ActionController::RoutingError (No route matches [GET] "/users/auth/facebook_access_token/callback"): #17

Closed peterept closed 9 years ago

peterept commented 9 years ago

I'm using devise + omniauth + omniauth-facebook + omniauth-facebook-access-token

When I try and call:

/users/auth/facebook_access_token/callback?access_token=XXX I get the routing error. I can see it calls into the omniauth-facebook-access-token strategy method callback_phase and that seems to work getting a token and the environment is correct. But then I get the exception above. Any ideas?
peterept commented 9 years ago

Figured it out, 2 things:

  1. Because I am using devise, I have to make sure I added facebook_access_token into my devise user:
app/models/user.rb
...
  devise ... :omniauth_providers => [:facebook, :facebook_access_token]
  1. Because facebook no longer provides user email by default, we need to add it in config:
config/initializers/devise.rb
...
  config.omniauth :facebook_access_token, FB_ID, FB_SECRET, {scope: 'public_profile,email', info_fields: 'email,name,verified'}

Be aware, Facebook users can be verified without an email now (eg: phone number)

Cheers!