Hello everyone,
I am encountering an issue while working with Cloud Code. When I use the following APIs:
economyCurrencyApi.incrementPlayerCurrencyBalance
economyInventoryApi.addInventoryItem
I am unable to increase the currency and inventory items for other players. When I pass in the player ID of another user to the APIs, I receive an error stating, “You are not permitted to access this user’s data.”
Is this a restriction imposed by Unity? I look forward to your response. Thank you.
Hi @Hansol08
I’m going to assume that you’re using the accessToken to authenticate the API requests as the accessToken represents the current player which will not have permission to affect another player’s state.
Therefore, you will most likely want to look at using Cloud Code’s serviceToken which will perform the action as a trusted server authority. More information can be found here: Service and access token support
and here Server authority
If you’re already using a serviceToken or it doesn’t appear to resolve your issue, please could you provide additional information on your Economy setup and sample code.
1 Like
Thank you for your reply.
I did use the accessToken,
I used the serviceToken and was able to successfully complete my purpose.
Problem has solved.
I’m sorry, my understanding in colud code is still limited.
Thank you again for your support.
1 Like