I am creating a Facebook Instant game and I am currently in the process of implementing Playfab. Eventually I would like to use “LoginWithFacebookInstantGamesId” of the playfab library but to get there I need the signed info via the “get_signed_player_info” method of the fbinstant library.
When I test everything inside the editor then it almost works, except that I get an error from Playfab, telling me that the signature is incorrect, even though everything seems to be set up correctly. So I figured that maybe it’s because I need to test the game live in browser after uploading to the fb app dashboard.
However, the issue seems to be that whenever I call get_signed_player_info the app freezes in the browser. I just see a black screen because the next scene is not loaded.
After I remove that code block then it runs fine.
This is the code:
Why not make it the same as the fb sdk expects? This way such confusion would not be created.
Why not return/log an error when invalid input was received in your function? If I had a clear error message telling me it expected a string and nothing else, I would not have created this forum post (assuming that it works with an empty string).
It would be absolutely great if the APIs were a 100% match. But Facebook does not provide a structured API spec that could be used to generate the bindings from JS to Lua which means that each function binding has to be created by hand.
In our documentation we say that “The extension provides an almost 1 to 1 mapping between the Javascript SDK and the Lua API.” We never promise an exact match, only something closely resembling the JS API.
By the way, this is a perfect opportunity to make a code contribution! I would recommend that you create a utility function in fbinstant.cpp that looks like this:
static int FBInstant_GetSignedPlayerInfoAsync(lua_State* L) {
int top = lua_gettop(L);
const char* requestPayload = checkstring(L, 1, ""); // <--- USING THE NEW FUNCTION!
luaL_checklistener(L, 2, getSignedPlayerInfoAsyncListener);
FBInstant_PlatformGetSignedPlayerInfoAsync((OnSignedPlayerInfoCallback)FBInstant_OnSignedPlayerInfo, requestPayload);
assert(top == lua_gettop(L));
return 0;
}
The code (luaL_checkstring) will generate a Lua error with a callstack if the value isn’t a string. Are you running the code from within a coroutine or inside a pcall()? If that is the case the error will not be visible in the console unless you manually catch and log it.