question

thibault avatar image
thibault asked

deleting user after my function

i have written this code in cloudscript but i don't find a way to delete a user with all its information could somone pls add this to my code (i have put //delete user were i want the code to be inplemented)

pls help me thx

handlers.hello = function(args) {
    var playerData = server.GetPlayerProfile({"PlayFabId": currentPlayerId, 
                                              "ProfileConstraints": {"ShowContactEmailAddresses":true}})
    
    if (playerData.Error == null){
        var contactEmailAdresses = playerData.PlayerProfile.ContactEmailAddresses
        if ((contactEmailAdresses != null) && (contactEmailAdresses.length > 0)){
            emailVerificationStatus = contactEmailAdresses[0].VerificationStatus;
            if (emailVerificationStatus != null){
                
                if (emailVerificationStatus == "Confirmed"){
                    var messagea = "confirmed";
                    return messagea;}
                    
                if (emailVerificationStatus == "Pending"){
		    //delete user
                    var messageb = "Pending";
                    return messageb;}
                    
                if (emailVerificationStatus == "Unverified"){
                    var messagec = "Unverified";
                    return messagec;}
    
}}}}
    
apisCloudScript
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

·
Sarah Zhang avatar image
Sarah Zhang answered

For clarification, the only API that can delete the master player account and the associated data including the credential data and account linkages is Admin API DeleteMasterPlayerAccount. The Admin/Server API DeletePlayer can be used to delete the player’s title account and the associated data. The difference of these two API is after deleting a player using API DeleteMasterPlayerAccount, its credential data, such as username, login email will be removed and can be used to create a new account, but after deleting a player using API DeletePlayer, although its associated data will be cleared up, the credential data and account linkages will still exist and can’t be linked by others.

According to your question, you want to delete the master players accounts completely, including the credential data and account linkages, is it right? If so, you need to call the Admin API DeleteMasterPlayerAccount. Since we don’t support to call the Admin APIs on CloudScript, so if you need to call the Admin API DeleteMasterPlayerAccount, we recommend you build an administrative tool to management the deletions of master player accounts.

For summary, the operation deleting player master accounts should be an action that be managed in centrality. If you don’t have an administrative tool, as a temporary workaround, you can write your logic as an Azure Function, and call the Admin API DeleteMasterPlayerAccount on it, then set a scheduled task for the Player Segment, trigger the corresponding CloudScript Azure Function for all players in the segment to delete player master accounts in batches. You can unlink this Azure function from your title after the deletion to prevent the potential security questions.

Besides, please note that the API calls for DeleteMasterPlayerAccount is a Profile Write operation, calling it in batches may cause a large amount of consumption. We suggest the launch titles don’t call this API a lot to clean up inactive accounts.

10 |1200

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

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.