question

DP avatar image
DP asked

Authenticating multiplayer binary to call CloudScript Functions?

I have a CloudScript function I need to periodically execute from my multiplayer binary running in a PlayFab VM. Naively just calling CloudScriptAPI->ExecuteFunction says that the request does not allow anonymous callers which makes sense, but I'm not sure what entity token I should be requesting in this use case?

How might I be able to call CloudScriptAPI->ExecuteFunction from my server binary? I'd prefer for it to not be anonymous, but that would also be fine if there's no other option. However, if I need to modify the access policy, could I restrict this call to a single function?

CloudScriptAuthenticationCustom Game Serversmultiplayer
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

·
Sarah Zhang avatar image
Sarah Zhang answered

For the clarification, API ExecuteFunction can't be used to call the legacy CloudScript function. The API ExecuteFunction is designed to call the Azure Functions integrated with PlayFab.If you want to call the legacy CloudScript functions on the server. You need to call the API ExecuteCloudScript or ExecuteEntityCloudScript.

As long as you have set the developer secret key on theserver, you can call the server API ExecuteCloudScript directly. If you want to call the API ExecuteEntityCloudScript or ExecuteFunction on the PlayFab Multiplayer Server. You can use the title entity token to authorize API access. To get the title entity token, you need to set the developer secret key on the server first, then call the GetEntityToken API. After GetEntityToken API gave the successful response, PlayFab SDK would store the title entity token programmatically. Then you can call the ExecuteEntityCloudScript or ExecuteFunction with the authorization of the title entity.

2 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.

DP avatar image DP commented ·

So that was my thought, when using the PlayFab SDK in UE4, I've already set the title and secret key information, I simply executed GetEntityToken without an explicit Entity set, is that the correct way to get the title entity token? I shouldn't specify any explicit entity?

0 Likes 0 ·
DP avatar image DP DP commented ·

capture.jpg

This is What I setup but I keep getting this in the logs.

Response : {"code":401,"status":"Unauthorized","error":"NotAuthenticated","errorCode":1074,"errorMessage":"This API method does not allow anonymous callers."}

This is my request:

LogPlayFab: Request: { "Entity": { } }

0 Likes 0 ·
capture.jpg (157.4 KiB)

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.