question

glen avatar image
glen asked

Adding Email and Password only to existing account

From the API documentation it doesn't seem that we're able to add an Email and Password to an existing account without providing a Username. However it is possible to use RegisterPlayFabUser to create an account without a Username. The problem here is that an existing account doesn't seem like it can use RegisterPlayFabUser because that creates a new account.

What I want to be able to do is add just an Email and Password to an existing account and then allow the player to use LoginWithEmailAddress. Is there a way to do this with the existing APIs?

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

·
brendan avatar image
brendan answered

That's correct - currently, the AddUsernamePassword API call would be the one to use, and as the name of the API call implies, the Username is part of the call. We do plan on adding more options to the user account system, but you can help with prioritization by using our Feature Requests forum to specify any new API calls you'd like to see in the service.

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

glen avatar image glen commented ·

Thanks, I added a feature request. Is there anyway to gain greater priority for this without gaining other user votes? I need this functionality for our game within the next 45 days. And I unfortunately can't use a work around by using a dud username or using the title display name. A dud username would not be unique and the title display name has length of 3-25 characters while the PlayFab username has a length of 3-20.

0 Likes 0 ·
brendan avatar image brendan glen commented ·

Sorry, but the only way to push something ahead of other things in the queue, when we're not getting feedback from many folks on it, would be via a custom development contract, but that's only available in the Enterprise tier - and even then, we have to evaluate our current work to determine if we could make it an option. Basically, we would be pushing something back in our schedule in order to take on unplanned work. That has a pretty high opportunity cost.

0 Likes 0 ·
glen avatar image glen commented ·

What about just increasing the username length to align with the title display name length, ie: 3-25 instead of the current 3-20. At least we could implement a reliable work around with that.

I understand your development queue requirements, but isn't this functionality that should already exist?

0 Likes 0 ·
brendan avatar image brendan glen commented ·

I can think of many things that I'd like to already have in the service, but no, "should" can realistically only be applied to things we've had a lot of requests for - and those are either already in, or are high in the queue. Even minor changes to the service require code review and test - there's no such thing as a "quick change", as the service has over 1,500 live titles (and many more in development). We have to have an excess of caution for even the most minor changes.

0 Likes 0 ·
glen avatar image glen commented ·

The only reason it seems like it should exist is because the APIs allow it in one instance (RegisterPlayFabUser) yet another instance does not allow it.

Regardless, I understand it's not a priority and I need to create another solution.

0 Likes 0 ·
kevin-4 avatar image kevin-4 commented ·

I've hit this issue as well and have a couple questions:

  1. Is there a workaround for this? I would like my users to only have to register using email and password. Can we set usernames to non-unique somehow so we can call AddUsernamePassword and pass in a valid, unique email but empty string username?
  2. Is there any API call to make to see all the connected accounts to a player? For instance, after a user is authenticated anonymously via their device, I'd like to first check any other previously connected accounts (like Facebook or PlayFab) and disabling the button to link said account, instead of calling the API for linking only to handle an error to due AccountAlreadyLinked.
  3. Is there any other account authentication type that's cross platform? Login with Google Account seems to be only for Android. Same with Login with Game Center being iOS specific. If there's no workaround for adding an email and password only with no username to an anonymous account, I'll like to switch it with a different cross platform solution.
0 Likes 0 ·
kevin-4 avatar image kevin-4 kevin-4 commented ·

1a. Better yet, I could just randomly generate a username and pass that into the API call. That way the requirement of it being unique is still satisfied, but the user doesn't have to worry about it. Do you see anything wrong with this approach? If I ever wanted to use the username field in the future, is there an API call for updating it? Even if there's not, I think this will be my workaround.

2a. If such an API call doesn't exist to check all connected accounts, I think I'll just set player data key value pairs to achieve this ('FacebookLinked': true). Since playerdata can be set to be returned during player authentication, I will have these values available to me without having to execute extra server calls.

4. There's a Link Facebook API call as well as its reverse, Unlink Facebook. Is there a reverse to AddUsernamePassword, if a user ever wants to unlink their PlayFab username and password account for their currently authenticated account?

0 Likes 0 ·
kevin-4 avatar image kevin-4 kevin-4 commented ·

Well my questions were never addressed, but for anyone else stumbling upon this thread:

My workaround was to let a user create an account using only an email and password, while I auto-generated a username for them. The username field is never used for my purposes so it was a good solution. That way I can still user the AddUsernamePassword API call and pass it all necessary fields.

I can't currently find a way to unlink an email and password account like you can with Google or Facebook, however, so I'm left to believe that said functionality doesn't exist.

0 Likes 0 ·
Show more comments
Show more comments
brendan avatar image brendan kevin-4 commented ·

For 1, yes, if you use RegisterPlayFabUser, you can create accounts using only email and password. But no, Usernames cannot be non-unique, as they are specifically unique identifiers in PlayFab. For non-unique names, you'll need to use the Title Display Name.

For 2, the GetAccountInfo/GetUserAccountInfo calls will get you that info, though there is a current issue that for the Device ID logins, they only show the most recently used ID for each type. So, if you have two different iOS and two different Android Device IDs linked, it'll only show the most recent iOS and Android IDs that were used (one each).

For 3, no, LoginWithGoogleAccount can be used from any device that can log into the player's Google account (PC for one, but you should also be able to do so on iOS). Twitch, Facebook, Kongregate, and Twitch are all also examples of logins that work on multiple platforms.

0 Likes 0 ·

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.