question

Robyn To avatar image
Robyn To asked

Server Backfill - Get Title EntityToken

From what I understand, my dedicated server needs to get a title EntityToken in order to create BackfillTickets.

I am getting an error and don't understand what is wrong.

My request is this:

Request: {
    "Entity":
    {
        "ID": "*****",
        "Type": "title"
    }
}

and I get this error:

Response : {
	"code":403,
	"status":"Forbidden",
	"error":"NotAuthorized",
	"errorCode":1089,
	"errorMessage":"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."
	}

Why is this Title entity token request being denied? Also, is it actually necessary to get this EntityToken?

My scenario is that I have a game server that should be able to have up to 20 players in it. I am not sure when to create backfill tickets or how I should give the server access to player EntityTokens.

sdksMatchmaking
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

·
Rick Chen avatar image
Rick Chen answered

You should get the title-level entity token on the server side by calling the GetEntityToken API with your title’s secret key before using the CreateServerBackfillTicket API. This token is required to create a backfill ticket. If you want the code example, please tell us which SDK you are using for your server code.

Server backfill tickets allow a game server to search for additional players which will fit into the game currently being played. Your server can create the backfill ticket after players have been matched and allocated to the server if additional players are required. Why do you want to give the server access to the player entity tokens?

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.

Robyn To avatar image Robyn To commented ·

I'm using the Unreal SDK

another post here talked about getting player entity tokens and frankly I do not understand if it is necessary: https://community.playfab.com/questions/45155/server-backfill-how-it-works-how-to-get-player-ent.html

0 Likes 0 ·
Robyn To avatar image Robyn To commented ·

What kind of authentication is needed to call GetEntityToken on the server side? I am using the SetPlayFabSettings call to set the secret and title before GetEntityToken but it does not auth. I get a 401 on GetEntityToken

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Robyn To commented ·

The title level entity token is required for the CreateServerBackfillTicket API since it is an entity API.

You can open Project Settings > Scroll to Plugins Category > PlayFab > and set your Title Id and developer Secret Key there.

Then you can use the following code to get the title entity id in Unreal:

authAPI =
IPlayFabModuleInterface::Get().GetAuthenticationAPI();
PlayFab::AuthenticationModels::FGetEntityTokenRequest request;
authAPI->GetEntityToken(request,
PlayFab::UPlayFabAuthenticationAPI::FGetEntityTokenDelegate::CreateUObject(this, &[Your Class Name]::OnSuccess),
PlayFab::FPlayFabErrorDelegate::CreateUObject(this, &[Your Class Name]::OnError)
);

where the auth API is defined as the following in the header file:

PlayFabAuthenticationPtr authAPI = nullptr;

You don’t need to assign any value to the request, as long as you have set your title id and developer secret key, you should get the title entity token successfully. The PlayFab SDK will keep the entity token internally for your following API calls, you can then use CreateServerBackfillTicket API.

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.