Facebook Test Print (SOLVED)

Hi,

I followed the Facebook Manual basic integration but without the platform added. I’m only testing it with the DMENGINE but I don’t get the pprint(response) in my Console.

When I test the app the Facebook login pops up and as soon as I press continue nothing happens.

Something like this is supposed to show in my Console when I test it:

DEBUG:SCRIPT:
{
  status = 200,
  headers = {
    connection = keep-alive,
    date = Fri, 04 Nov 2016 13:54:33 GMT,
    etag = "0725a4f703fe6af27da183cfec0bb22637e331e0",
    access-control-allow-origin = *,
    content-length = 53,
    expires = Sat, 01 Jan 2000 00:00:00 GMT,
    content-type = text/javascript; charset=UTF-8,
    x-fb-debug = Pr1qUssb8Xa3x3r1t913hHMdefh69DSYYV5vcxeOB7O33mcfShIw+r7BoLpn147I2wzLF2CZRTpnR3/VYOtFpA==,
    facebook-api-version = v2.5,
    cache-control = private, no-cache, no-store, must-revalidate,
    pragma = no-cache,
    x-fb-trace-id = F03S5dtsdaS,
    x-fb-rev = 2664414,
  }
  response = {"name":"Max de Fold ","id":"14159265358979323"},
}

I think you need to bundle using the bundle menu and install that version for it to work. Once you have it installed you’ll be able to target it (if it’s a debug version) from the editor as well.

So, I re bundled and installed the debug version on my device but still nothing is happening. And the target is set to the device.

You mean that you haven’t added Android in the settings for you app on Facebook? You need to do that. And make sure the package name matches what you have in game.project.

Must the app be available on Google Play for this to work because I haven’t yet created an app for this on Google Play.

So I’ve added the Android platform with the Google Play Package name and it matches the one from my game.project and I received this:

There was a problem verifying package name: com.player.swiper on Google Play. Please check the package name and try again.
If your app isn’t listed publicly on Google Play yet you can ignore this message.

My app is not yet listed publicly on Google Play.

No, not to my knowledge.

So this is the script I have:

local function get_me_callback(self, id, response)
   -- The response table includes all the response data
   pprint(response)
end

local function fb_login(self, data)
   if data.status == facebook.STATE_OPEN then
      -- Logged in ok. Let's try reading some "me" data through the
      -- HTTP graph API.
      local token = facebook.access_token()
      local url = "https://graph.facebook.com/me/?access_token=" .. token
      http.request(url, "GET", get_me_callback)

   elseif data.status == facebook.STATE_CLOSED_LOGIN_FAILED then
	  print("Login Failed")
   end

   if data.error then
	  print("Error")
   else
	  print("No Error")
   end
end

function init(self)
-- Log in with read permissions.
local permissions = { "public_profile", "email" }
facebook.login_with_read_permissions(permissions, fb_login)
end

Its only printing “Login Failed” and “Error”

I tried printing the data.error and it gave me this:

The key hash does not match any stored key hashes.

I probably need to add the key hash.

I solved this by generating a key hash from my certificate.pem and pasted it into Key Hashes Field on Facebook.

1 Like

Yep, it’s in the instructions:

:slight_smile:

1 Like