question

Markus H avatar image
Markus H asked

Server.DeletePlayer not working as expected

Hi there,

I want my players to be able to delete there account within the unity app. I have added a cloud script for that and call it with ExecuteCloudScript().


If executed, all goes well, the call is successful and the player (and the master player) vanishes from the PlayFab-Webinterface.

Now, I log in again with the credentials of the deleted player (or with a not unlinked custom id).

I expected the log in call to fail with an "AccountDeleted" error as specified here. But the log in succeeds and the player is visible in the playfab webinterface again. As if the deletion never happened.

Am I missing something? For me it looks like a bug. The server sets the account active again like if you delete a facebook account and log in again. But it should answer with the "AccountDeleted" error and delete the account some time in the future.

Cloud script:

handlers.DeletePlayer = function(args) {
    var request = {
        "PlayFabId" : currentPlayerId
    };
    var deletePlayerResult = server.DeletePlayer(request);
    log.info("Deleted player with result " + deletePlayerResult);
}

I am using the Unity-SDK 2.106.210406

Player DataAccount ManagementCloudScript
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

·
Citrus Yan avatar image
Citrus Yan answered

To be clear, Server.DeletePlayer only deletes the player from a title, aka the title player account, therefore the master player account (publisher user account) won’t get deleted. To delete the master player account , you should use Admin/DeleteMasterPlayerAccount. And, regarding the issue “the server sets the account active again” you were talking about , mostly likely the previous title player account did get deleted (erased statistics, custom data, inventory, etc. ), I think you should be able to find that the new “active” account won’t have any data (statistics, custom data, etc. ) attached, sort of like a brand new account.

4 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.

Markus H avatar image Markus H commented ·

Well, yes the master account might not be deleted - for me it looks that way since it is not accessable through the web interface anymore. But that is only a side notice.

For the actual issue:

The spec says:

"Until the player data is fully deleted, attempts to recreate the player with the same user account in the same title will fail with the 'AccountDeleted' error."

So any log in attempt should fail after Server.DeletePlayer() has been called. Or am I wrong here.


Just for clarification, here are the steps to reproduce as pseudo code:

  1. clientAPI.LoginWithCustomID()
  2. clientAPI.AddUserNamePassword()
  3. (via cloud script) serverAPI.DeletePlayer()
  4. clientAPI.LoginWithEmailAddress()

Step 4. still succeeds but should not, should it? If step 4 creates a fresh player account that would be quite fatal in my opinion.

From a player perspective:

The player plays game A and game B from the same company.

If the player deletes its account from game A but still want to play game B from the same company, he would not expect the login to still work for game A until (s)he reregisters to game A.

Is there some additional way to unlink a master player account from a title?

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Markus H commented ·

>>Step 4. still succeeds but should not, should it? If step 4 creates a fresh player account that would be quite fatal in my opinion.

The time used for player deletion varies, sometimes it finishes right after Server.DeletePlayer() is called, therefore clientAPI.LoginWithEmailAddress() will succeed with a brand new title player account; however, sometimes it takes several minutes or more, therefore clientAPI.LoginWithEmailAddress() will return "AccountDeleted". Among my test cases, most login calls will succeed with a brand new account and some calls will return "AccountDeleted".

>>Is there some additional way to unlink a master player account from a title?

For a PlayFab account (uses email/username - password as credentials), there is no API for it, however, for credentials such customid, facebook account, there are APIs available:

Account Management - Unlink Custom ID (PlayFab Client) | Microsoft Docs

Account Management - Unlink Facebook Account (PlayFab Client) | Microsoft Docs

0 Likes 0 ·
Markus H avatar image Markus H Citrus Yan commented ·

Ok, thanks. That is unfortunate. Could this behaviour be included in the API descrition, please?

I only stumbled about it by accident. I guess others might not even realise that the log in credentials of a user still work for the title the user was deleted from.

I guess I will simply specify the account deletion in the user help then. I am already planning to delete the master player automatically when the user deletes the last title-player.

Thanks again for the clarification!

0 Likes 0 ·
Show more comments

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.