question

ajon542 avatar image
ajon542 asked

How do I use the PlayFabGroupsAPI ApplyToGroup method?

Hi,

I'm experimenting with the PlayFabGroupsAPI and I've managed to create a group with one player based on the example code given here here https://docs.microsoft.com/en-us/gaming/playfab/features/social/groups/quickstart.

If I give another player the group id, how can that player join the group using the ApplyToGroup method?

It is unclear how I can get the PlayFab.GroupsModels.EntityKey to pass to this method in order to be able to join the group.

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

·
ajon542 avatar image
ajon542 answered

After some trial and error, I've been able to successfully request to join the group by:

var groupId = "2B7F88084218721E";


_groupService.ApplyToGroup(groupId, new PlayFab.GroupsModels.EntityKey
{
    Id = PlayFabAuthenticationService.EntityKey.Id,
    Type = PlayFabAuthenticationService.EntityKey.Type
});

Where the PlayFabAuthenticationService.EntityKey comes from the entity key in the SilentlyAuthenticate response.

After this, I do get an error during the AcceptGroupApplication as I likely don't have permissions to give myself access to the group. Hopefully, there is a way to just let any user join the group as long as they have the groupId.

/Group/AcceptGroupApplication: The claim was not allowed to perform the requested action based on the entity's access policy. Policy comment: By default, all requests are denied. If you expected this request to succeed, you may be missing a policy. See the permissions APIs in PlayFab's Admin Api to add a permission.
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 ·

The user with a Administrator role (for instance, the creator of the group) should be able to call /Group/AcceptGroupApplication to accept a group application, did you try that?

1 Like 1 ·
ajon542 avatar image ajon542 Citrus Yan commented ·

Yep after a little more investigation, from the group admin role I was able to ListGroupApplications and then AcceptGroupApplication. Thanks!

0 Likes 0 ·
Citrus Yan avatar image Citrus Yan ajon542 commented ·

Great! Happy coding:)

0 Likes 0 ·

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.