Skip to content

Commit 9bdebc3

Browse files
committed
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 '\'.
1 parent 9f4a2b9 commit 9bdebc3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/rest-graph.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,13 @@ def old_rest path, query={}, opts={}
326326
opts)
327327
end
328328

329+
def broken_old_rest path, query={}, opts={}
330+
post_request(old_rest(path,
331+
query.merge(:access_token => "#{app_id}|#{secret}"),
332+
:suppress_decode => true).tr('\\', '')[1..-2],
333+
opts[:suppress_decode])
334+
end
335+
329336
def exchange_sessions opts={}
330337
query = {:client_id => app_id, :client_secret => secret,
331338
:type => 'client_cred'}.merge(opts)

0 commit comments

Comments
 (0)