question

racso avatar image
racso asked

Username AND e-mail required in AddUsernamePassword but not in RegisterPlayFabUser

I'm using PlayFab Unity SDK. According to the docs (and confirmed by experimentation), AddUsernamePassword [1] requires a username AND an e-mail address. However, you can create a PlayFab acccount with only a username OR an e-mail address by using RegisterPlayFabUser [2].

Is there a reason for that discrepancy? Is there a way to only add e-mail+password to an account?

I'd like to simplify the register form for my users, so I don't want to ask for both usernames and e-mails. I tried to pass an e-mail as both the username and the e-mail, but it isn't accepted because it contains invalid characters.

[1] https://api.playfab.com/documentation/client/method/AddUsernamePassword

[2] https://api.playfab.com/documentation/client/method/RegisterPlayFabUser

sdksAuthentication
10 |1200

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

jital avatar image
jital answered

Hello,

AddUsernamePassword and RegisterPlayFabUser are API calls for two different operations. AddUsernamePassword is used so that any anonymous user can create a recoverable account. In the event that something happens to their device. While RegisterPlayFabUser is used to create a recoverable account from the very beginning.

Here are some user account best practices.

If you do not want to inundate users with so many prompts at the start of your game, you can implement an anonymous login and give them the option to add information to recover the account at a later time with AddUsernamePassword

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.

racso avatar image racso commented ·

Thanks for the answer, but I'm afraid it doesn't answer the question.

I know what are both calls for. What I'm asking is why you can create an account with RegisterPlayFabUser by using EITHER an e-mail or a username, but you can't add only an e-mail or a username to an existing account with AddUsernamePassword because it requires BOTH.

In other words: it's clear that PlayFab accounts don't require both an e-mail and a username to work, because you can create them with only one value. Why, then, can't you associate just one value via AddUsernamePassword?

0 Likes 0 ·
brendan avatar image brendan racso commented ·

This is a historical artifact from the old days of PlayFab. Simply put, the Add... API call was added after the fact, and for a specific purpose - adding all three values to an account (email, password, username). It was the result of a specific request at the time, and wasn't planned in conjunction with the Register... or Login... calls. In that legacy API, if you don't want to have a password, I'd just generate a random GUID, so that it can't be easily discovered.

0 Likes 0 ·
lopokmam avatar image
lopokmam answered

I now having this same and I guess the answer above is asking either use username or email but not the password in this case. So do I, I wonder why AddUsernamePassword has to use both the username and email, I want to only use the email address. Is it possible?

10 |1200

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

esk avatar image
esk answered

this is literally so annoying. why do we need both username and email? Playfab get on this right now, it's literally such a bottleneck to your product.

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.