question

Darius Vu avatar image
Darius Vu asked

How do we get the profile data of each member in the group? - NotAuthorized

Dear team,

I am developing the group and want to show the display name of each member in the list of applications. I am trying to use PlayFabProfilesAPI.GetProfile() to get Profile data of each application/ member. However, when I call this GetProfile() function then it has the issue "/Profile/GetProfile: NotAuthorized". Do you know why and how to fix it?

private void GetListGroupApplicationSucessCallback(ListGroupApplicationsResponse result)
{
     // show the list of group application
     foreach (GroupApplication application in result.Applications)
     {
          PlayFab.ProfilesModels.EntityKey Profile_EntityKey = Convert(application.Entity.Key);
          var request = new GetEntityProfileRequest { Entity = Profile_EntityKey };
          // This function has the issue - /Profile/GetProfile: NotAuthorized
          PlayFabProfilesAPI.GetProfile(request,
          response =>
          {
		Debug.Log(response.Profile.DisplayName);

          }, GetProfileError);           
     }
}

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

·
Darius Vu avatar image
Darius Vu answered

This is the solution that I found and fixed this issue. If other has the better solution, please tell with me. Thanks.

We need to set the permission for all the players in this title to be able to use this API by following way:

[Title Settings] -> [API Features] -> [Entity Group Title Policy]

Change Policy Json file as below:

  {
    "Action": "Read",
    "Effect": "Allow",
    "Resource": "pfrn:data--*!*/Profile/*",
    "Principal": "*",
    "Comment": null,
    "Condition": null
  },
  {
    "Action": "Read",
    "Effect": "Allow",
    "Resource": "pfrn:data--*!*/Profile/*",
    "Principal": {
      "ChildOf": {
        "EntityType": "*"
      }
    },
    "Comment": null,
    "Condition": null
  },
3 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.

Citrus Yan avatar image Citrus Yan commented ·

BTW, you can use GetProfiles instead, which retrieves multiple (1 to 25) entity profiles in a single request.

1 Like 1 ·
Darius Vu avatar image Darius Vu Citrus Yan commented ·

In the method that I mentioned in the question, I used this GetProfile(), but it has the issue "/Profile/GetProfile: NotAuthorized". So the solution in my comment above is fixed it.

0 Likes 0 ·
brendan avatar image brendan Darius Vu commented ·

The one thing I'd add is to please consider the impact these reads will have on your Profile Read meter (https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/meters/profile-reads#profile-apis and https://docs.microsoft.com/en-us/gaming/playfab/features/pricing/consumption-best-practices). If this is done as a result of a player-initiated action, this could result in a lot of "ticks" on that meter.

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.