Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Andy Tsen · Oct 30, 2019 at 01:32 AM · dataTitle Dataentities

How do I read Entity Title Data Objects from my Backend server?

Hi,

I've been trying to figure out entity access permissions all day to no avail. I'm storing level and other static data via entities on the title. It successfully uploads data to TitleID with "title" as the EntityType in my Unity Editor tool.

However, when I run the same code in playmode it fails saying

There was an error with your playfab call! /Authentication/GetEntityToken error: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.
UnityEngine.Debug:Log(Object)
PlayfabUtils:OnPlayFabError(PlayFabError) (at Assets/Scripts/Utils/PlayfabUtils.cs:11)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:259)
PlayFab.Internal.<Post>d__12:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:189)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)

The code that will query playfab lives on our own server, and so is not public to the client.

Here is the code it's failing on

PlayFabAuthenticationAPI.GetEntityToken(new GetEntityTokenRequest() {
            Entity = new PlayFab.AuthenticationModels.EntityKey() {
                Id= "D889",
                Type = "title"
            },
        },  (entityResult) => {
               entityId = "D889";
               entityType = "title"; 
 	//rest of callback code here
  {
    "Action": "Read",
    "Effect": "Allow",
    "Resource": "pfrn:data--*!*/Authentication/*",
    "Principal": "*",
    "Comment": "test to allow all authentication calls to be successful",
    "Condition": null
  } //here is the permissions I tried to make but I have no idea what I'm doing.

And here is the API call it's making https://D4889.playfabapi.com/Authentication/GetEntityToken?sdk=UnitySDK-2.76.191015

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Sarah Zhang · Oct 30, 2019 at 07:14 AM

It looks like your TitleId is D4889 but the Entity.Id you write in your GetEntityTokenRequest is D889. PlayFab will return this error message when the Entity.Id of the request body is wrong. The typo is one of possible reasons why you get this error. Besides, if you have logged in a player account before calling GetEntityToken with a title entity, it would return this error too. If so, it is related to API policy. You can check API access policy for more about API policy.

However, generally, it isn’t recommended to “ENABLE ADMIN API” on clients or set the API Policy for clients to give them title level permissions. In this case, it’s safer to use CloudScript than changing API policy. Clients can call ExecuteEntityCloudScript to access CloudScript entity functions. CloudScript has permission to access the title’s entity object. And clients can get the title object info through CloudScript. So, using CloudScript can prevent the possible security risk caused by permission escalation. You can refer to the following CloudScript code.

handlers.getTitleObjects = function (args, context) {
    var getObjectsResult = entity.GetObjects({
        Entity: {
            Id: "[YourTitleID]",
            Type: "title",
            TypeString: "title"
        }
    });

    return {
        getObjectsResult: getObjectsResult
    };
};
Comment

People who like this

0 Show 1 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Jordan ♦ · Apr 06, 2020 at 05:23 PM 0
Share

There has been an update to the location of the API access policy documentation that Sarah mentioned above.

Please see the following for more information on configuring API Access Policies: https://docs.microsoft.com/en-us/gaming/playfab/api-references/api-access-policy

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    3 People are following this question.

    avatar image avatar image avatar image

    Related Questions

    Client_focus_change 1 Answer

    Is there a way to Send Data between Clients ? 1 Answer

    Recover previous version of Title Data 1 Answer

    GetUserData vs GetPlayerProfile ? why Different 1 Answer

    Hey i wanted to get the catalog CustomData.do can i do it only by using cloud script ? 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges