Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rest-graph.rb: add RestGraph#broken_old_rest, see:
http://www.nivas.hr/blog/2010/09/03/facebook-php-sdk-access-token-signing-bug/

if you're getting this error from calling old_rest:

  The method you are calling or the FQL table you are querying cannot be
  called using a session secret or by a desktop application.

then try broken_old_rest instead. the problem is that the access_token
should be formatted by "#{app_id}|#{secret}" instead of the usual one,
and the json returned by facebook is broken too, need to remove the
quotes and the extra '\'. for instance:

  "{\"app_id\":\"123\"}"

instead of the correct one:

  {"app_id":"123"}

so, there are two hacks in broken_old_rest. one is faking access_token,
the other one is fix the json by removing extra quotes and the '\'.
  • Loading branch information
godfat committed Sep 13, 2010
1 parent 9f4a2b9 commit 9bdebc3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/rest-graph.rb
Expand Up @@ -326,6 +326,13 @@ def old_rest path, query={}, opts={}
opts)
end

def broken_old_rest path, query={}, opts={}
post_request(old_rest(path,
query.merge(:access_token => "#{app_id}|#{secret}"),
:suppress_decode => true).tr('\\', '')[1..-2],
opts[:suppress_decode])
end

def exchange_sessions opts={}
query = {:client_id => app_id, :client_secret => secret,
:type => 'client_cred'}.merge(opts)
Expand Down

0 comments on commit 9bdebc3

Please sign in to comment.