question

drew avatar image
drew asked

Economy V2: AddInventoryItemsAsync in Azure function always gives error

would any kind soul take mercy on me and take a peak at why I can't get my very first Azure Function to work in PlayFab? I am trying to do the simplest example of giving the player an item when the function is called, but I keep getting "Must call Client Login or GetEntityToken before calling this method" error when trying to use the AddInventoryItemsRequest. This error makes no sense because I am using it as an authenticated user whose account I just created, and I can see in the payload that EntityToken is being provided

Azure code is here: https://pastebin.com/zeELJQha

C#/Unity code here: https://pastebin.com/45vMM1EW

Payload the C#/Unity code is sending is this: https://pastebin.com/ns5Kii5x

JSON from PlayStream Monitor: https://pastebin.com/QwGPHkgK

In-Game Economy
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

·
Xiao Zha avatar image
Xiao Zha answered

The "Client login or GetEntityToken must be called before calling this method" error message means you need EntityToken of player or Title level to call AddinventoryItem API, the code your commented out "titleAuthContext.EntityToken = context.TitleAuthenticationContext.EntityToken;" is correct, it should be uncommented, or you can pass in the player's EntityToken for AddInventoryItes API call. If you have other issues, please feel free to let us know.

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.

kylemc@microsoft.com avatar image kylemc@microsoft.com commented ·

@Xiao Zha I am no longer aware of any bugs in the `AddInventoryItems` API that haven't been patched. If you see any that you can repro, please tag me in the comments.

0 Likes 0 ·
Xiao Zha avatar image Xiao Zha kylemc@microsoft.com commented ·

Sorry, we just tested it again on a new Title and found that the API works fine. It is a misjudgment caused by a problem with the test Title we used before.

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.

Error rendering WebPanel (widgets/consolidation-widget.ftl): org.hibernate.hql.internal.ast.QuerySyntaxException: AvailableConsolidation is not mapped [from AvailableConsolidation up where up.node = :node]