question

Darius Vu avatar image
Darius Vu asked

How to change the password with username?

Dear support team,

I am using this function to register an username with a password.

https://docs.microsoft.com/en-us/rest/api/playfab/client/authentication/registerplayfabuser?view=playfab-rest

public void RegisterPlayerWithUsername(string _username, string _password, Action<RegisterPlayFabUserResult> successCallback, Action<PlayFabError> errorCallback)
    {
        var request = new RegisterPlayFabUserRequest()
        {
            Username = _username,
            Password = _password,
            RequireBothUsernameAndEmail = false
        };

        PlayFabClientAPI.RegisterPlayFabUser(request, successCallback, errorCallback);
    }

Do we have any method or function API in order that the user can change the password after they login?

Thank you so much!

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

·
Sarah Zhang avatar image
Sarah Zhang answered

If you have registered the player using a password and a username or an email, the player can only reset the password through the link in the account recovery email. There is no API can achieve the password changing in one call.

According to your description, you seem to want to register the players firstly, then update the username and password for them. If so, we would recommend you using LoginWithCustomID to register the player instead of using RegisterPlayFabUser, then use the API AddUsernamePassword to add the new username and password for the player. For more details about the Login basics and best practices, please check our document -- Login basics and best Practices - PlayFab | Microsoft Docs. And for the corresponding C# example, please check this section -- Using Email Templates to Send an Account Recovery Email - PlayFab | Microsoft Docs.

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.

Darius Vu avatar image Darius Vu commented ·

Thank you for your support.

This is my issue now. In my app, parents will register their account using their email (PlayFabClientAPI.RegisterPlayFabUser). Then the parent will create account for their kids (who don't have the email) using an username and password as the kid account.

But the issue is that we don't have any way to change or reset the password of kid accounts, is it right?

If I use LoginWithCustomID to register the account for kids and add a password then will we have any way to change or reset the password in case they forget their password?

Thank you again,

0 Likes 0 ·
Sarah Zhang avatar image Sarah Zhang Darius Vu commented ·

>> If I use LoginWithCustomID to register the account for kids and add a password then will we have any way to change or reset the password in case they forget their password?

No, the password and username can be only added once.

For the clarification, in PlayFab authentication system, the email address is necessary for the process of resetting password. If the user doesn't provide any email address, the use can't use the resetting password feature.

For your case, if the workarounds we provided previously are not suitable for you, you can try to implement the reset passwords feature on your own. Or consider changing your feature design. Thanks for understanding.

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.