Kain avatar image
Kain asked

LoginResult.NewlyCreated is false for previously deleted accounts

This is happening when using client LoginWithCustomID, and may affect any "resurrected" account.

I frequently delete my test account and recreate it upon login, and I notice that this account has a different value for NewlyCreated than an account that has first login with a customID that has never been existed before.

Somehow, creating a new account from a customID that used to exist for a previously deleted account causes NewlyCreated to be false. I am unaware of any other means of determining whether this was a freshly created or resurrected account.

I use that bool to gate whether or not GetPlayerProfile gets called afterwards, since you can't call GetPlayerProfile on a NewlyCreated account. As an extra bit of information, GetPlayerProfile called when NewlyCreated is false on a resurrected account will fail with error 'ProfileDoesNotExist'.

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

How soon after the player delete are you calling login? One thing to be aware of is that deletion puts the player account in a queue to be deleted, so if you're calling the login before the deletion has actually completed, it's entirely possible you're not creating a new player account at that point. We're planning on doing some additional work with the delete path to help with this soon.

10 |1200

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

Kain avatar image Kain commented ·

Sometimes seconds. Sometimes minutes. I figure this is an issue most likely exclusive to devs. I ran into this after a particularly aggressive cycle of create-delete iterations on the same account as I was testing the new account code path from the client side. This probably blew up that queue.

That's good to know about deleted accounts being queued. I totally understand about needing to batch those expensive operations. Makes sense.

I figure this was worth noting as a bug since it did cause ambiguous results on the client side:

  • NewlyCreated being False
  • at the same time GetPlayerProfile returned ProfileDoesNotExist error

... that would not have been apparent unless I happened to know what was going on with that particular account on the server side.

My instinct tells me that there may be other issues related to deleted accounts being in this liminal state as it feels very similar to my old war stories about garbage collected and memory-pooled objects.

0 Likes 0 ·
brendan avatar image brendan Kain commented ·

Since the linked credentials are the only thing that could cause a collision, getting those cleared when the account is queued should prevent any issues. We'll be adding that to the delete logic as soon as we can.

1 Like 1 ·
plourdegui avatar image
plourdegui answered


I am facing a similar scenario.

  1. I login via LoginWithFacebookRequest,
  2. I link a CustomId to the account.
  3. I delete the player via a CloudScript (server.DeletePlayer),
  4. I can confirm that the entry is no longer present in the player's list in the Game Manager
  5. I wait for any amount of time (seconds, minutes, hours, days, weeks)
  6. I login again via LoginWithFacebookRequest for the same Facebook user.
  7. The loginResult says NewlyCreated=false, loginResult.LastLoginTime=null and the PlayFabId is the same that got created the first time, despite the player having been deleted. Also, there is still the same CustomId linked to the account. However, the creation date of the master player account matches the time at which it was resurected, not the time at which it got created in the first place.

It looks like the player account never was really deleted but simply resurected, independently of the amount of time between the delete and the next login.

Can you please confirm what is the expected behavior here?

In the mean while, I will use loginResult.LastLoginTime==null to check if the game was really freshly created.

10 |1200

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

Andy avatar image Andy ♦♦ commented ·

Take a quick look at the help text for DeletePlayer. In particular, this line:

Does not delete the publisher user account that created the player in the title nor associated data such as username, password, email address, account linkages, or friends list.

DeletePlayer operates on the title player account, not the master player account. That means there is still an account linked with those logins, it just doesn't have any data associated with the title for which you called DeletePlayer.

If you want to fully remove an account from the system, you need to call DeleteMasterPlayerAccount.

1 Like 1 ·
plourdegui avatar image plourdegui Andy ♦♦ commented ·

When pressing on "Delete Player" via PlayFab's Game Manager, does it run a DeleyePlayer or a DeleteMasterPlayerAccount?

Does the Game Manager offer the two ways of deleting an account?

If not, why so?

0 Likes 0 ·
Andy avatar image Andy ♦♦ plourdegui commented ·

It's DeletePlayer. It's primarily that way because that functionality came first and we felt that the API was sufficient for the more robust formal delete.

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.