question

Talha avatar image
Talha asked

Linking Accounts does not update stats

Hi Playfab, So the problem i am encountering is that When i link Android/Ios Id with facebook.

The stats dont update.(linking is all done, working great).

Player install the game, launches the game. player is logged in with android/ios login.

player plays the game. get some coins by playing 5-6 times (e.g 500) NOW player decides to link the account to facebook.

player logs into facebook (both android/Ios account and facebook account linked) now when I click on the linked account and check the stats, the stats are empty.

What could be the issue here? I am not calling any cloudscript to update the stats. Do i have to?

i thought the sats would get linked to the fb account aswell.

Account ManagementIn-Game Economy
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Seth Du avatar image
Seth Du answered

Let’s divide the process into 3 steps

  1. Player install the game, launches the game. player is logged in with android/ios login.
  2. player plays the game. get some coins by playing 5-6 times (e.g 500) NOW player decides to link the account to facebook.
  3. player logs into facebook (both android/Ios account and facebook account linked) now when I click on the linked account and check the stats, the stats are empty.

The 3rd step is wrong, when the 1st step is done, there is a new account (A) created (assume the player logins for the first time). In the 3rd step, when you call loginwithFacebook, another account (B) will be generated, and the current login information will be overwritten by B. That’s why you get empty.

The solution is replacing the login API calls in the 3rd step with API LinkFacebookAccount.

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Talha avatar image Talha commented ·
@SethDu

Cheers mate. Worked like a charm, like a charm. But in doing so confused myself. Are we supposed to call loginwithfacebook Anytime?

Dont we need to create an account for facebook?

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Talha commented ·

As you have mentioned, you are using android/ios login by default. Players will be able to access their accounts because the newly created account has been linked with their device ID. In other words, If they login with device ID for the first time, the process will be like [register a player account] -> [link the device ID to the account].

Hence, calling LinkFacebookAccount will bind another identity to the existing account. You can access this PlayFab Player Account via either Device ID (LoginWithAndroidDeviceID) and Facebook(loginwithfacebook). You can see all the linked identity at [Game Manager] -> [Players] -> [Select one to check Overview Page]. You are also free to add additional ones there.

In terms of Facebook, as far as I know, the access token from Facebook will expire after around 2 hours. By then, you won't be able to access Facebook related features like Friends Lists (but the session ticket from PlayFab will last 24 hours, which means basically there are no influences on PlayFab side). You need to generate a new token from Facebook and call LinkFacebookAccount again to refresh it.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Talha commented ·

Here is an example, I have 4 identities for this account and am able to access this account via any one of them.

0 Likes 0 ·
Talha avatar image Talha commented ·

Got it. Thanks. here how i am doing it. Player taps on facebook button. Hes shown two options "First time login" and "recover account".

if he uses first time login (I go with the link account route like youve described)

if he uses recover account (i go with loginwithfacebook route and then check linked ids etc).

just one last question:

if at anytime player decides to unlink the Default deviceID associated with its recoverable account.

(that deviceID account) is lost right? because we dont want player to unlink the device with facebook and if he sells the mobile to someone, the buyer can still access all the progress of the seller.

0 Likes 0 ·
Seth Du avatar image Seth Du ♦ Talha commented ·

You may merge a randomly generated string with device ID so that it will be unique. Theoretically, it is possible to access the same account if you directly using the same device ID unless you unlink the account before the device is sold.

1 Like 1 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.