Hi Community and Support team,
I am facing a few issues with Group API with C# SDK.
I am using C# SDK to communicate with Playfab from Azure Function. Azure Function Application uses the latest SDK version 1.107.211209 via Nuget Package.
We are using Group API for various operations like...
- Creating Group for Player 2 using Player 1's Entity Token
- Add Members to the group.
- Remove Members From the Group.
- Promote or demote Player Role.
- Add/Remove Group Invite or Apply To Group (this is optional like we can stop using this API to control cost via LiveOps Setting.)
I am trying to Add one of my friend (eg. Player 2) to my group using AddMembers of Group API.
Unfortuanly I am not able to do it and getting error like this
{ "code": 401, "status": "Unauthorized", "error": "NotAuthorized", "errorCode": 1089, "errorMessage": "Entity title_player_account!D#3#4#5#1#6#C#1# is not a member of group group!A#2#0#E#1#2#B#6#." }
In my case scenario, we manage player info in our Cosmos DB like player Master and player_tItle_accout id.
So when we have to add any player in the group, we are providing Group id and Player ID (Title) and create Request to Add Player in the group
var groupAPIRes = GetGroupAPI(gameTitleId, devSecretKey, context, method); if (groupAPIRes.HasError) return result.UpdateError(groupAPIRes.error, groupAPIRes.detail); var members = new List<EntityKey> { }; playerTitleIds .ToList() .ForEach(o => members.Add(CreateTitlePlayerEntityKey(o))); var group = CreateGroupEntityKey(groupId); var request = new AddMembersRequest { Members = members, Group = group, RoleId = GroupRoles.MEMBER }; var response = await groupAPIRes.data.AddMembersAsync(request);
In c# Code we are using Group Instance API. Group Instance API Instance is being generated with App Settings and Authentication Context.
The Authentication context contains the Entity token and Session Ticket from Player 1 (this is the player who executing Azure function from PlayFab Automation Hook)
the Player Title Ids fields are an array of strings that contains other player's Player ID (ID).
I am not sure why I am getting the error. like it's Group Policy Issue, Game Title Policy Issue, or Auth Context Issue.
I also tried to modify my group Policy and added the below content in Group Policy. But that also does not help.
{ "Action": "AddMember", "Effect": "Allow", "Resource": "pfrn:group--*!*/Members/*", "Principal": { "ChildOf": { "EntityType": "title", "EntityId": "MY-GAME-TITLE-ID" } }, "Comment": "Allow All entities to Add Members to the group", "Condition": null }, { "Action": "AddMember", "Effect": "Allow", "Resource": "pfrn:group--*!*/Roles/*/Members/*", "Principal": { "ChildOf": { "EntityType": "title", "EntityId": "MY-GAME-TITLE-ID" } }, "Comment": "Allow entities to Add any role that they are in", "Condition": null }
Can you guys provide some insight or some documentation about Policy or Group API restrictions?
Thanks in Advance.