2

I'm using this Omniauth Middleware to validate facebook access tokens form an iOS app.

This strategy is installed like so:

Rails.application.config.middleware.use OmniAuth::Builder do
  provider :facebook_access_token, Settings.facebook.key, Settings.facebook.secret
end

This works wonderfully via this url:

/users/auth/facebook_access_token/callback?access_token=<snipped>

However, if I add a .json to the end of the path my route still triggers but it fails to trigger the middleware.

/users/auth/facebook_access_token/callback.json?access_token=<snipped>

I know it fails to trigger because I can see log activity related to strategy when it triggers, and when it fails I get none. It also does not populate request.env["omniauth.auth"] with the data I need.

My route that picks up both of those paths is:

match 'users/auth/facebook_access_token/callback' => 'omniauth_callbacks#facebook', via: :all

So how can I can get the middleware to trigger when I use a .json request format, so that I detect that and render a JSON response?


Related but mostly unsolved: How do I make OmniAuth Identity accept JSON post data?

Community
  • 1
  • 1
Alex Wayne
  • 178,991
  • 47
  • 309
  • 337

0 Answers0