rails_api_auth
rails_api_auth copied to clipboard
TOKEN_URL's order of appearance for params seems to matter
I came across an odd issue today when I was implementing facebook authentication in development against a test app I had set up and I'm wondering if anyone else has seen it.
TOKEN_URL in facebook_authentication.rb sets the redirect_uri at the end of the string. Mine had been set and I verified that it matched what I had used for the
- Oauth dialog request
- my app's settings on Facebook under Settings -> Basic -> Website -> Site URL
- and also the Valid OAuth redirect URIs under Client Settings
but I kept seeing
facebook API request failed with status 400.
facebook API error response was:
{"error":{"message":"Missing redirect_uri parameter.","type":"OAuthException","code":191,"fbtrace_id":"FUCYqE8QrwS"}}
I noticed in the FB documentation for Manually Building a Login Flow under Exchanging code for an access token that the parameters are documented in a different order than in facebook_authentication.rb's TOKEN_URL, namely, redirect_uri appears between client_id and _client_secret instead of at the end after code.
I updated my local gem's version of TOKEN_URL to match the order of the params in the documentation and it started working. I wouldn't suspect this would matter but in my case it did.
I'm having this same issue. Would you mind sharing the location of the file you edited? I can't seem to find it. Thanks!
@alfredoreduarte take a look at rails_api_auth/app/services/facebook_authenticator.rb