question

Andy Pickard avatar image
Andy Pickard asked

Username from a title player id

I'm using the Lobby system to form groups before matchmaking together, and I've got it all working except, I'd like to display the name of the player that has invited someone to the Lobby - currently I only have access to the 'PFEntityKey invitingEntity', so I can get the ID from that, which is the title player ID, but I can't figure out how to get the username from this to display.

I've tried a couple of things suggested elsewhere: GetProfile, but it gives an authorisation error, I've tried adding an object to the title player which contains the username but, and get it with GetObject and get an authorisation error again.

Is there really no easy way to get a players username from the entity key? I feel I have to be missing something because it's such a basic thing

multiplayer
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

·
Xiao Zha avatar image
Xiao Zha answered

The authorization error is because the players only have the right to get the profile of themselves. You can modify the Global entity policy in Title Settings->API feature page to allow player to get other player’s object directly, then call GetProfile/GetObjects to the object which contains the username. Here is the code:

  {
         "Action": "Read",
         "Effect": "Allow",
         "Resource": "pfrn:data--*!*/Profile/Objects/**Objectname** ",
         "Principal": "*",
         "Comment": "Allow objects profile access",
         "Condition": null
       }
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.