question

JJ avatar image
JJ asked

Find Other User in Playfab using Username

Hi. I have this feature in my game where users can search for other user based on their username (not playfabId) and find their profile, before adding them as friend.

The problem I am facing now is that, since the user only input username, I'm unable to get other information about the user, such as its avatar url (which I need to display the profile pic to my current user, so he know who he is searching for)

The workaround I have is using

PlayFabClientAPI.GetAccountInfo(new GetAccountInfoRequest
        {
            Username = searchField.text	// Search field is the text the user enters
        }

and in my json configuration, I allow the current user to actually access other user's information with a rule, so I can get the account info of a random user (as long as the username matches).

The problem here is that, I would need to make another call to get the avatar URL (through GetPlayerProfile) using the playfab id I've received in this case.

To summarize, I can find a way around it, but it seems quite inefficient as I'm making multiple calls and potentially introducing a security risk.

Are there any solution to this?

apisCloudScriptdata
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

·
Seth Du avatar image
Seth Du answered

The current behavior is by-design, and I believe you may need a workaround solution to this. Using Cloud Script/Azure Function (CSAF) will be a recommended way. Since you have a specific “Rule” in your game, you may implement a CSAF where the client will send the DisplayName as parameter to the function and the additional Profile-retrieval APIs will be called in the function after the “Rule” has been verified. The clients will simply received any information you have coded to process in the function.

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.