"Error validating client secret." 404 with Facebook Oauth and ruby

I am trying to implement facebook authentication for an app with warden, after the user allows facebook auth and redirects to my app callback with the token I get a 400 while consuming the api. My warden 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 this:

{"error":{"type":"OAuthException","message":"Error validating client secret."}}

I am pretty shure the app id and app secret are the ones provided by FB.

Thanks.

Answers


I've seen that error message many times. Here are the things I would double check:

  • your domain is the same as what you listed in the facebook callback url
  • the app id is correct (actually print this out on a page, sometimes y
  • the app secret is correct

Need Your Help

Why does the Windows registry exist?

windows unix registry

this is more OS architecture question than programming directly, but still. Why was the Windows registry created as a completely separate subsystem for storing system/application settings? In *ni...

Identify groups of continuous numbers in a list

python list range continuous

I'd like to identify groups of continuous numbers in a list, so that: