I am trying to implement facebook authentication for a supervisor application, after the user allows facebook authentication and redirects my application with a token callback, I get 400 by consuming api. My overseer strategy is this:
class Facebook < Warden::Strategies::Base def client @client ||= OAuth2::Client.new MyApp::Facebook::AppID, MyApp::Facebook::AppSecret, :site => 'https://graph.facebook.com' end def params @params ||= Rack::Utils.parse_query(request.query_string) end def authorize_url client.web_server.authorize_url :redirect_uri => request.url, :scope => 'email,publish_stream' end def authenticate! throw(:halt, [302, {'Location' => authorize_url}, []]) unless params['code'] facebook = client.web_server.get_access_token params['code'], :redirect_uri => request.url rescue OAuth2::HTTPError => e puts e.response.body end end Strategies.add :facebook, Facebook
The result of printing the response body is as follows:
{"error":{"type":"OAuthException","message":"Error validating client secret."}}
I am pretty sure that the application identifier and application secret are those provided by FB.
Thanks.
Macario
source share