question

Ozan Yilmaz avatar image
Ozan Yilmaz asked

Create/Register a New User via Cloudscript?

Hello everyone,

Is there a way to create/register an account via cloudscript like the one "RegisterPlayFabUser" in the client API?

Why do I need this? I am trying to make a feature where the player can their nickname by buying it with a virtual currency. Here's the problems I came across and that's why I am trying to create/register a user via cloudscript.

- The players can change their nicknames. If I use the "Username" feature of PlayFab, I cannot change the nickname anymore.
- The players can enter any types of characters (even emojis) in their Display Name. To be able check if the nickname they enter is valid for my criteria, I need to register an user in the server side while checking the nickname.
- Entering any characters rather than the ones in the ASCII table makes the player unfoundable in the game, which brokes a logic in the game. Another way to do this is e-mail address, however, I don't wan to expose the player's e-mail addresses.

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

·
Citrus Yan avatar image
Citrus Yan answered

Username is used with password for player authentication while DisplayName is the title specific name for the user. I don’t get why you want to register a new user to handle changes of player nicknames. If you do that, the player will need to log into that newly created account in order to use the new nickname, which means that they will lose all their data on previous accounts.

Therefore, What I recommend is using CloudScript without registering a new user for this feature:

a. Checking whether nicknames are valid

b. Change their nickname in their Display Name.

Since the UpdateUserTitleDisplayName API is currently not in the Server API set, you may need to build a custom server that calls the Admin UpdateUserTitleDisplayName API and make a Weekhook call from CloudScript to that server requesting display name change. (We do not recommend making http requests to Admin API endpoints directly in CloudScript). In the meantime, you can also make a request about adding the UpdateUserTitleDisplayName API into the Server API set so that you can call it directly via CloudScript if you find it important for your project.

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.

Ozan Yilmaz avatar image Ozan Yilmaz commented ·

Thank you for the answer.

I currently don't use the username feature for the players. The players can login in my game via e-mail and password. I use display name as their nicknames. The problem is that the player can enter emojis in their nickname, which is not acceptable in the game. If I do an if statement in the game code, the player can easily pass this. The client may send fake data.

Since I cannot afford a custom server at the moment, I am trying to find a way to do this via Cloudsript.

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan Ozan Yilmaz commented ·

Here is a workaround, maybe you can store each player's display name in their Read Only Data, in this way, clients can only read their display name. In order to change their display name, they must submit it to Cloud Script where you can do some checking/validation before changing their nicknames using Server/UpdateUserReadOnlyData.

1 Like 1 ·

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.