Hey everyone! Sorry for asking this again - I know this question has been addressed here, but I looked through the questions and answers to no avail. I tried the suggested solutions but I'm still stuck. Here's my conundrum:
I'm implementing a "fastpass" way to join a Guild without requiring the usual Application & Acceptance process. This is something my users have requested. AddMember is working fine! I tested it and everything is working great so far.
But I noticed that AddMember will add someone to a PlayFab group even if they are already a Member, which is too bad. (Any way to prevent that?) For example, I was an Administrator of my testing group and when I called the function it added me to the Members role, so I had two roles.
So then I thought, what if I call IsMember first and prevent a double sign up? That's when I got this error:
Results of checking Membership:
{
code: 401,
status: 'Unauthorized',
error: 'NotAuthenticated',
errorCode: 1074,
errorMessage: 'This API method does not allow anonymous callers.'
}
Here's the code I'm using to call this. Trying to see if my Title Player Account is inside an existing Group:
const isMemberBody = {
Entity: {
Id: "2A5E4AC524D8168D",
Type: "title_player_account"
},
Group: {
Id: "75128ABCBE270F34",
Type: "group"
}
};
// Create the Request Headers
const isMemberHeaders = {
'Content-Type': 'application/json',
'X-EntityToken': "Hardcoded X-EntityToken goes here",
'X-SecretKey': process.env.PLAYFAB_API_SECRET_KEY,
};
I'm using some hardcoded Entity Tokens for testing that I'm generating via existing sections of my backend that are working, but I didn't want to paste them here. As of this writing, the X-EntityToken I'm using expires in 24 hours, so that shouldn't be the issue.
What am I doing wrong? What is an anonymous caller? Why didn't AddMember give me this problem, since I called it exactly the same way? What is the solution? I'm sure PlayFab allows a player to check if they are a member of a group.
For what it's worth - I am aware that I can do a "client side check" of Memberships to see if the user is in the Group before allowing them to press the button, but I really prefer to do that stuff on the server for security reasons.
Thanks for the help, let me know if you need to see any more code!