I’m stuck, trying to use the Facebook API. I have successfully managed to get a token(verified on Facebook), and now I’m stuck, trying to access my token and user-data. I’ve been trying to see if I can find an answer in the API reference, but I don’t know where I fail. Could someone please just guide me in the right direction for how I use the API to get data?
My obvious attempts (that off course don’t work, for some reason):
...
local fb_me = facebook.me -- this results in DEBUG:SCRIPT: function: 0x147f6de10
...
...
local fb_me = facebook.me() -- This results in DEBUG:SCRIPT: nil
...
Stupid question but did you check the manual? Pay special attention to the last paragraph, “Caveats”, regarding the devapp etc. It’s also important to obtain the correct facebook permissions when interacting with that service.
Regarding high score, you should be able to do that by manually constructing http requests outside of our facebook api (which is quite barebone). Read more in the facebook docs.
You guys rock. It was off course me, that misinterpreted what the caveats said. How that is possible, is beyond me, since the manual is loud and clear. It work flawlessly now, when I debug through my bundled app, so I should be able to move along on my own from here. At least for the moment. Thank you so much, @Ragnar_Svensson .
Happy to hear it works! When working with facebook interaction, make sure to use hot-reload all the time with the scripts and the on_reload function. It makes everything so much easier and even quite fun.
Thank you, i success to use http.requet to get high score from Facebook Graph API. But i have a problem, when first time i request score, its successfully but in second time I request, its error FATAL:DLIB: ETag mismatch ("981ebe231dbb462cec0347f71aaafc757ac4ce38" vs ) ERROR:SCRIPT: HTTP request to 'https://graph.facebook.com/v2.5/me/scores?access_token=CAAIZAM7tgTYgBAFXUxoUZBfAnGOsRu55O4QgsrLNhY8GUDYR9CIZBlHIcOQcqMjs1aZCuD34N4ZAZCpvT2w907UWCM5h5wB7GsPOX52ZAURDyB2BlU25tD5k0JlNZBwGQbggkLc4kr7eJ61cR1sgJ2btXsMOoO21sPlszpgb5MZCwXevlrXXseTgeNRFZAwYuKXy4ZD' failed (http result: -8 socket result: 0) DEBUG:SCRIPT: 0 DEBUG:SCRIPT: DEBUG:SCRIPT: { expires = Sat, 01 Jan 2000 00:00:00 GMT, content-type = text/javascript; charset=UTF-8, connection = keep-alive, content-length = 0, access-control-allow-origin = *, pragma = no-cache, x-fb-debug = JQD41MeNlCzH9dh+I/ezr8oB1bTDywfF2L25NcnZzchujXV4PMCWJI4r+kOjEy82OgNZ9SKpyNnucPLpAfEVeA==, facebook-api-version = v2.5, date = Fri, 08 Apr 2016 10:16:43 GMT, cache-control = private, no-cache, no-store, must-revalidate, x-fb-rev = 2274481, x-fb-trace-id = DtH4V+9DuTN, }
My code
`local function http_result(self, id, response)
print(response.status)
print(response.response)
pprint(response.headers)
pprint(facebook.access_token())
if response.status == 200 then
local dta = json.decode(response.response)
pprint(dta)
gui.set_text(self.face_node, dta.data[1].score)
else
gui.set_text(self.face_node, “Error: “…response.status…”(”…facebook.me().name…")")
facebook.logout()
end
end
Thanks for reporting this. It sounds as an issue in the engine and how we deal with HTTP caches. I’ve created a ticket for this: DEF-1743 @Ingela_Garneij, could we try to look into this as soon as possible?