question

Dylan Hunt avatar image
Dylan Hunt asked

AddUsernamePassword "email already exists"--what..?

Picture should explain my confusion

EDIT: Wow that pic got downsized. Here:

https://i.imgur.com/6mvMAMx.png

https://api.playfab.com/Documentation/Client/method/AddUsernamePassword )

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

Nazariy Tymkiv avatar image Nazariy Tymkiv commented ·

I have this bug too :(

0 Likes 0 ·
brendan avatar image brendan Nazariy Tymkiv commented ·

Please see the answer, below. This isn't a bug - the AddUsernamePassword call is designed to add these elements to accounts that don't have them at all. What I would recommend is that you "like" the Feature Request for having a way to add the username separately from the other elements: https://community.playfab.com/idea/641/208255238-Add-Edit-Username-Post-Account-Creation.html.

0 Likes 0 ·
Nazariy Tymkiv avatar image Nazariy Tymkiv brendan commented ·

Sorry, my bad. I confused the page, please check my similar comment to other thread. Sorry for my bad English :)

0 Likes 0 ·
brendan avatar image
brendan answered

[Edit] Correction: Not moving, as I now see that you've already added this request to Feature Requests - thanks!

 

To answer your question, the AddUsernamePassword API call was added to provide a way for titles which don't use a username/password or email/password system to add those elements (so, initial account creation with Device ID, Facebook, etc., etc.), so this hadn't come up previously. Providing a way for a title to add any of those elements if they don't exist does seem like a good thing for us to add. I'd be concerned about using it as an "update", however, as that creates a potential security issue for your titles. Getting people to reveal their sign-in info in online sessions is a common social-engineering hack these days, so allowing a client to update the email and password without having to go through a customer service rep is something many titles actually wouldn't want. I'll add this as two items - one as a backlog item to review and update the AddUsernamePassword path (and likely update with a new API call which provides optional parameters specifically for adding them where they don't exist on the player profile), and another to add an Update call which is off by default (as with the virtual currency and statistic calls from the client). Please bear in mind that these do need to be prioritized normally, so I'll move this to the Feature Requests forum, to see if others want to vote it up.

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

Right, that API call is designed to add a username, email, and password to an account that was set up via one of the authentication mechanisms that don't include that, like Device ID. It sounds like you're using it on an account that already has those - is that the case?

10 |1200

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

Dylan Hunt avatar image
Dylan Hunt answered

For example I only had email address and password sign in. I only recently added username. So now I detect if missing a username when logging in.  

Missing username? Prompt for username, send username email and password to client api Add username password. 

So how can I add a username when they already have a password and email (YES the user has email, YES the user has password, but NO he does not have username and trying to add that)? 

EDIT: Also, since it's called "AddUsernamePassword", it doesn't make sense to REQUIRE an email since it already REQUIRES a session -- seems a bit redundant.

My suggestion: 

Copy+Paste AddUsernamePassword as a template, but make ALL fields optional, but REQUIRE a session: call it UpdateUserInfo (there's an UpdateUserInfo, but that's custom game data). If password, add/update password. If username, add/update username. If email, add/update email.

Since these 3 are all publisher level (right?), how about this:

// Sample Request
POST https://{ {TitleID}}.playfabapi.com/Client/UpdateUserInfo
Content-Type: application/json;
X-Authentication: <user_session_ticket_value>{
    "Username": "theuser", // Optional
    "Email": "me@here.com", // Optional
    "Password": "thepassword" // Optional
}


// Sample Response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
X-Authentication: <user_session_ticket_value>{
    "code": 200,
    "status": "OK",
    "data": {
        "DataVersion": 3
    }
}

10 |1200

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

Dylan Hunt avatar image
Dylan Hunt answered

"I'd be concerned about using it as an "update", however, as that creates a potential security issue for your titles. Getting people to reveal their sign-in info in online sessions is a common social-engineering hack these days, so allowing a client to update the email and password without having to go through a customer service rep is something many titles actually wouldn't want"

Agreed -- You're right -- not an update, but just an improved "Add" as you mentioned where all 3 are optional

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

Sounds good - thanks!

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.

merlineus avatar image merlineus commented ·

I'm have the same question - adding username to already registered PlayFab account with email and password set. Is there any progress?

0 Likes 0 ·
brendan avatar image brendan merlineus commented ·

If you'd like to see this added, I would recommend clicking the Like option on the Feature Request post Dylan added: https://community.playfab.com/idea/742/209074188-UpdateUser-Info.html. We prioritize in part based upon the aggregate feedback from the community.

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.