question

MGGD avatar image
MGGD asked

Initiating File Upload fails with "All Requests Are Denied"

Hello, I am trying to upload a file but I always get this error:

Init Failed Error/File/InitiateFileUploads: 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)
PlayfabScript:OnInitFailed(PlayFabError) (at Assets/Playfab/Scripts/PlayfabScript.cs:210)
PlayFab.Internal.PlayFabUnityHttp:OnResponse(String, CallRequestContainer) (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:262)
PlayFab.Internal.<Post>d__20:MoveNext() (at Assets/PlayFabSdk/Shared/Internal/PlayFabHttp/PlayFabUnityHttp.cs:191)
UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
``` 

When I checked the the games Settings -> API Features, I couldn't find any policy with the above comment (By default, all requests are denied.).

I tried adding the following permission, but it didn't work:

{
    "Action": "Write",
    "Effect": "Allow",
    "Resource": "pfrn:data--*!*/Profile/Files/FILENAME",
    "Principal": {
      "ChildOf": {
        "EntityType": "namespace",
        "EntityId": "<My game's Publisher ID>"
      }
    },
    "Comment": "Allow all namespace members to write files",
    "Condition": null
  } 

Thank you.

entities
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

·
Hernando avatar image
Hernando answered

Based on your description, I guess you are uploading files to other players' entities instead of their own entity?Or are you using the "members" role to upload files to the group entity?

In the first case, for security reasons, I don't recommend that you do this. It will make it easy for players to cheat in the game. Players can bypass the client you release and send API requests to modify other players' data via HTTP Request tool like Postman.

In the second case, by default, there are two roles in a group: "admins" and "members". And only "admins" can upload a file to group entity. If the player is a "members" and tries to upload the file to the group entity, you will get the error above. There is no detailed documentation about Group Policy at this moment as it is currently under development and some features may be modified. If your group is created from the client, then the player who created this group can upload a file to the group entity.

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

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.