question

kabumere avatar image
kabumere asked

Deleting users from PlayFab

So I've been doing a lot of testing with my game, making sure initial login from new and returning users is as friction-less as possible. However I have some questions when it comes to managing test accounts I've made:

1) Why does 'DeleteUsers' from the Admin API only delete linked account info and not everything pertaining to that ID? It leaves login info and the IDs themselves. Is there anyway to delete EVERYTHING about a player so that the custom ID no longer shows on the backend at all?

2) I used the 'Try it' button on: https://api.playfab.com/Documentation/Admin/method/DeleteUsers
to delete the users. Is there a better way to perform this request in the future?

3) How come after I used DeleteUsers to delete my computer's custom ID info from the backend, the next time I logged in with this same computer I was given a new custom ID on the backend? Since I'm supplying the very same unique information for my computer, shouldn't the same ID be generated and returned by PlayFab? Going back to question 1, what's the point of keeping some of that older information around if we won't reuse it the next time the same device/computer tries to log on?

apisAccount Managementgame manager
10 |1200

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

brendan avatar image
brendan answered

Sure thing:

Correction - when a player is deleted, you're removing that player from the game, not the Publisher ID (the account is defined at that level, so that you share the core account across all games - for UserPublisherData and association of all events to that player, for example).

Until it has cleared the queue though, the title-specific elements (inventory, stats, title display name, player data, etc.) may not be deleted yet.

We'll be adding state info to the Game Manager soon, to help clarify when the account is in this state.

Leaving the Postman note in though, as I do find it incredibly useful:

Personally, I'm a huge fan of Postman (https://www.getpostman.com/). I use it, and our Postman Collection (https://github.com/PlayFab/PostmanCollection) many times a day. You can set up multiple environments so that you can switch between titles easily, and you can quickly highlight and right-click to save the Session Ticket whenever you do a login call from it.

We do not generate Custom IDs. Can you walk us through specifically what API calls you're making, what the values are you're passing in, and where those values are coming from?

10 |1200

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

kabumere avatar image
kabumere answered

1) When I use the DeleteUsers call and supply a PlayFab ID, If I use the Game Manager dashboard from the developers.playfab.com website and click the Players tab, that PlayFab ID still exists and is shown there. When I click on it there are no longer any linked custom IDs, but my question is why does the playfab ID even stick around after we delete it? Will PlayFab ever issue a new user that PlayFab ID again in the future?

2) Can you explain a bit how Postman works, if you have time?

3) Sorry, I was using terms wrong. What I meant was, after I deleted a user using DeleteUsers and passing in the PlayFab ID I wanted to delete, why is it that the next time I go to login with the same Custom ID I used previously am I not given a different PlayFab ID in the result?

So I call:

LoginWithCustomIDRequest request = new LoginWithCustomIDRequest() {
                TitleId = PlayFabSettings.TitleId,
                CreateAccount = true,
                CustomId = customID
            };

With the same custom ID as before the deletion, but in the request below:

PlayFabClientAPI.LoginWithCustomID(request, (result) => {
                PlayFabManager.PlayFabId = result.PlayFabId;
                Debug.Log("Got PlayFabID: " + PlayFabManager.PlayFabId);


                if (result.NewlyCreated) {
                    Debug.Log("New user account. Let them choose a display name and such.");
                } else {
                    Debug.Log("Returning user. Welcome!");
                }
            },
            (error) => {
                Debug.Log("Error logging in player using their device:");
                Debug.Log(error.ErrorMessage);
            });

the result.PlayFabId is now a different value than the one I deleted previously. I thought the same CustomID will keep generating the same PlayFab ID, even after the PlayFab ID had been deleted?

10 |1200

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

brendan avatar image
brendan answered

For 1, it's that the events remain. When deleting a player, it removes everything but the historical events and the PlayFab ID (which the events reference). That way, the player is effectively removed, while still giving you the ability to aggregate the anonymous information about usage. You can think of the PlayFab ID and the associated account as just the remaining "husk", as it were. And since the PlayFab ID is a 64bit value, there's no real change you will ever need that ID for future use.

Postman is a tool for making Web API calls quickly and easily. Their main page (the getpostman.com link above) does an excellent job of summarizing what all you can do with it - I highly recommend it, as it makes our lives easier. :)

For 3, can you give us your specific repro steps? I just created a user in my test title with a Custom ID (LoginWithCustomID, with CreateAccount set to true) and got an account. I then deleted that account with Server/DeleteUsers, then created another account with the same Custom ID (I'd saved the call in Postman, so all I did was step back to it in the History and re-send it). The new account had a completely different PlayFab ID. I deleted that one and created another, and got a third PlayFab ID.

10 |1200

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

kabumere avatar image
kabumere answered

Hey Brendan,

1) Thanks for the explanations. It makes sense, we probably would want to still query that player's data later on even if we deleted their account. I can't think of a time I've ever want to delete a player's account though. Ban them perhaps, but never delete. Even from lack of play.

2) Thanks, I'll delve deeper into the postman website in the morning.

3) What you're experiencing is exactly what I described above. Why does that occur? Shouldn't a CustomID always generate/return the same PlayFab ID? So why is it that after we delete a PlayFab ID, PlayFab doesn't just return that same ID the next time a user with the same Custom ID tried to log-on?

10 |1200

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

brendan avatar image
brendan answered

Ah, I see. Sorry, from what you said above, it sounded like you didn't understand why the new account had a new PlayFab ID. Simply put, when you delete an account, that deletes everything unique about it, apart from the PlayFab ID. That means that the Custom ID is no longer associated with that account at all. So, if you use it to sign in again, it doesn't exist. So if you have CreateAccount set to true, a new account will be created (and, if not, you just won't sign in).

10 |1200

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

kabumere avatar image
kabumere answered

So I was thinking PlayFab ID's were created by somehow hashing the custom ID value with something else, that's why I thought a particular Custom ID would always produce the same PlayFab ID, even if that PlayFab ID was previously deleted.

But it sounds like that's not the case. A PlayFab ID is simply chosen at random for new users. There's no sort of hashing of Custom IDs done what so ever. So a Custom ID could create 100 different PlayFab IDs if you continuously deleted the new PlayFab IDs before signing in the next time.

That clears up a lot, thank you!

10 |1200

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

brendan avatar image
brendan answered

Correct. There are many different authentication methods (Device ID, Custom ID, Google, Facebook, etc.), each of which can create an account. The PlayFab ID is not a hash of any of them, it is a distinct, randomly generated ID.

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

kabumere avatar image kabumere commented ·

Also I think I'm using this system incorrectly. Should my follow up questions be added as "comments" like this one, or "replies"? Because it seems replies are treated as 'Answers'... which my follow up questions are anything but lol.

0 Likes 0 ·
brendan avatar image brendan ♦♦ kabumere commented ·

In general, if it's not an answer, it should probably be a comment. This is a Q&A style of forum, so the idea is that an answer can be voted on by others, to bubble it up. But since the answer tagged as "correct/best" is the one that's always at the top under the question, it's not something we have to be 100% diligent about.

0 Likes 0 ·
kabumere avatar image
kabumere answered

Follow up on this older question:

For purposes of the TestGame I made on PlayFab, is there a way to TRULY delete all of a player's info so that it no longer shows under the Players tab of the GameManager? I understand in production all remaining anonymous information about usage from that player could be valuable and you would probably never want to delete it fully, but for testing as I add new parts to the player initial start-up experience, older player accounts on Playfab that were created before the changes client side don't have certain data fields attached to them that all accounts must have. I know I can just go manually add these fields to the backend for each player every time I make a change, but it would be way easier to just delete all previous accounts, and then on the next login let the game treat the person as a new user and initialize and add all those values for me. Would save time as I'm constantly testing on multiple devices. Don't want my Players section to get crowded with older accounts.

So, is there an easy way to delete all leftover info of a Player so that they no longer appear after they've been deleted with the API calls?

10 |1200

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

brendan avatar image
brendan answered

Not in the sense you mean, no. Because the events will remain, the PlayFab ID must remain. So the shell account - which again, has been stripped of everything relevant to that player, including all authentication mechanisms, statistics, data, inventory, etc. - will remain. That should have zero impact on your testing, however. There is no way to sign into those accounts, and the Players tab listing is really just the list of the last 50 accounts that signed in, so they will scroll off after a short period of testing, in most cases. There should be no need to add any fields to those accounts.

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

kabumere avatar image kabumere commented ·

Got it, thank you. It wasn't that I was adding fields to deleted accounts, i was just anticipating the players tab getting full the more I delete players and retest logging in, since I'm continuously updating my code for new users that adds data to their playfab account the first time they log in and only the first time. so older accounts that were created before the changes didn't have that data added to them and I had to keep deleting (I know I could have manually added the key Value pairs.. just felt delete and re-login was easier).

Speaking of the Players tab however, if a player uses their device for login and never connects a social media account, how would I ever be able to pinpoint their account? There's no way they could find out their PlayFabID and tell me right? Should I require all new users that use a device also choose a username? and even then, do user names have to be unique? Couldn't multiple users choose the same username theoretically?

0 Likes 0 ·
brendan avatar image brendan ♦♦ kabumere commented ·

If you're not connecting any other account type, and you're not having the player create an account name, you'd need to display the PlayFab ID to them somewhere, so that they could send that to you for customer support issues.

0 Likes 0 ·
kabumere avatar image kabumere brendan ♦♦ commented ·

Do I have this right?:

1) UpdateUserTitleDisplayName is to be used whenever a user makes a new account, whether it's via Device, Facebook, Steam, or whatever. It will be a unique name for that game (title) only. When a user first gets a new account, they NEVER have a default Display Name, we must give them the option to set it.

2) The only time players have a username and email associated with them is if they Login using the PlayFab account API call.

3) Usernames created via the PlayFab login API call are unique across ALL of a publisher's games under PlayFab, however DisplayNames are only unique to one particular title of a publisher under PlayFab.

Also, question:

4) Do I personally have to set something so that accounts created via Facebook, Device, Steam (basically anything other than PlayFab's account system) can be used under any of my titles that use PlayFab? So if a user logs in through Game1, then logs into Game2 the next day, the backend will show that it's the same user account/same device, just logging into different games.

Thanks for the help! This service is so damn powerful.

0 Likes 0 ·
Show more comments
sathyaraj avatar image sathyaraj commented ·

Hi @Brendan,

I deleted a user in dashboard players section. the deleted account was linked with Facebook. Now when i try to login i get "HandleOnLoginFail -------------------- : Error 400: The account has been marked for deletion." Error. How do i reset it so i can login again with facebook

0 Likes 0 ·
brendan avatar image brendan ♦♦ sathyaraj commented ·

What's the Title ID and PlayFab ID for this?

0 Likes 0 ·
sathyaraj avatar image sathyaraj brendan ♦♦ commented ·

deleted playfabid : C30F0BB187EB963D And game title id is : 6ED1

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]