question

sebastiengaumin avatar image
sebastiengaumin asked

CreateDraftItemRequest returns NotAuthorized even with Policy activated

Hello!

I was trying to create a draft item using Economy V2, with the following data using Unity C#:

 PlayFabEconomyAPI.CreateDraftItem(new CreateDraftItemRequest
 {
     Item = new CatalogItem
     {
         AlternateIds = new List<CatalogAlternateId> { new CatalogAlternateId { Type = "FriendlyId", Value = "FirstItem" } },
         CreatorEntity = new EntityKey { Id = PlayFabSettings.staticPlayer.EntityId, Type = PlayFabSettings.staticPlayer.EntityType },
         Type = "catalogItem",
         Title = new Dictionary<string, string> { { "NEUTRAL", "FirstItem" } },
         CreationDate = DateTime.UtcNow,
         StartDate = DateTime.UtcNow
     }
 }, CreateDraftItemOnSuccess, OnPlayFabCallbackError);

Even though I made sure to have the policy enabled for the Player, I still got the following issue.

 /Catalog/CreateDraftItem: Calling Entity does not have permissions to the Item Type.

What is the purpose of having a policy for the CreateDraftItem, if we actually have another layer of policy when trying to set the Type property?

7002-wwmdyfrt3b.png

Thank you in advance for your help on that!

apissdks
wwmdyfrt3b.png (35.3 KiB)
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

·
Neils Shi avatar image
Neils Shi answered

The setting of enable CreateDraftItem for players in Game Manager is designed to allow players to create 'ugc' items, players do not have permission to create the items of type 'catalogItem'. To create the catalogItem type items using the API CreateDraftItem, you need a title level entity token, which can be obtained by https://learn.microsoft.com/en-us/rest/api/playfab/authentication/authentication/get-entity-token?view=playfab-rest .

1 comment
10 |1200

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

sebastiengaumin avatar image sebastiengaumin commented ·

It makes sense, switching that parameter to 'ugc' made it work. Thank you!

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.