question

sandboxkaraton avatar image
sandboxkaraton asked

Reset the password of all users as admin

Hello

I'm migrating all of my clients users from a different backend to Playfab. To make sure all users will still be able to login to their accounts I would like to reset every users password to a default value.

I noticed that I can manually change a users password in the Player dashboard, but I can't seem to find any api to automate this for all of the users. Am I missing something? Is there a way to setup some automation to set every single users password to something else?

Thanks in advance!

(Please disregard the safety issues this solution has. No user actually knows their playfab login data, this is all managed by a custom account system.)

Player DataapisAccount Management
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

·
Made Wang avatar image
Made Wang answered

PlayFab currently has two methods to reset the password, one is to select Change password in Game Manager, the other is to use account recovery email to reset the password, refer to Using Email Templates to Send an Account Recovery Email - PlayFab | Microsoft Docs.

You can send an account recovery email by calling an Azure Function Cloud Script for each player in the segment All Players via Scheduled Tasks. And then through the Rule, when the event sent_email is triggered, an Azure Function Cloud Script is called. In the Azure Function Cloud Script, first determine whether the EmailTemplateType is AccountRecovery, then obtain the Token, and finally use the obtained Token to call ResetPassword. The context model of Cloud Script will be used here, please refer to PlayFab CloudScript using Azure Functions Context Models - PlayFab | Microsoft Docs.

However, the above method will send the mail to the player, and they will know that you are resetting their password.

As a workaround, since the player's password needs to be set to the same value, can the login email be used as the CustomId so that the player can use LoginWithCustomID to log in? Then call AddUsernamePassword to add their username and password, or use the second method above to have them reset their password.

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.