It seems the Facebook’s global leader board service has been deprecated (source).
This means if I want to have non-contextual leader boards (which I do), I need to figure out another method. One such option I’ve looked at is Playfab’s leader board service. However, for that to work, it seems to be, that players must be logged in first (authenticated). However, I would to remove the requirement for the players to log in when playing the instant game.
How can I authenticate the user for Playfab using facebook credentials, and do it in the background, so the player would not notice?
My only goal is to set up a leader board, which can be query-d 2 ways:
A - get all leaderboard entries and show the top ranks and the player rank.
B - get all entries and ranks of Facebook friends and the player
Is Playfab a good option in this case? Do you recommend anything else? Since I have very little experience in setting up my own custom backend with a data base, and I have little time, I would really like to solve this issue using a third party solution.
Not sure, that is possible. For login you should provide a token. For getting this token you need to require an user access. Also a token has a time limit. Maybe if the target platform is html and you can forward a token and user name from js to lua… Not sure here.
Another way is using a custom ID. Genereate random ID once when an user is playing for the first time, than save it and using for next authenticate processes. But in this case you have not a username for associate to this account.
function M.uuid()
math.randomseed(os.time() + os.clock() + random(1, 1000))
local a = random(1, 10) + random(1, 10) + random(1, 10)
local template ='xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'
return string.gsub(template, '[xy]', function (c)
local v = (c == 'x') and random(0, 0xf) or random(8, 0xb)
return string.format('%x', v)
end)
end
Also notice that Playfab changed their price plans and provide free plan only before 100k users (this numbers reach quickly with anonim authenticate).
Like @Dragosha said, I’d use PlayFabClientApi.LoginWithCustomID(), but instead of creating a custom ID I’d use the unique ID you get from Facebook. That way you could cross reference the IDs easily.