Hello,
I'm having an issue with CloudScript/Unity SDK
Basically I'm making a CloudScript function that's supposed to get data from player's account - in this case, a token (ex: 8jhxv9qk4isk1ckdrt0) which was previously generated and saved to the account. Here I'm supplying a PlayfabID to that account to get the saved token:
handlers.getRandomToken = function (args) { var playerData = server.GetUserReadOnlyData({"PlayFabId" : args.inputValue, "Data" : ["Token"]}); var token = {}; if(playerData.Data.hasOwnProperty("Token")) { token = playerData.Data["Token"]; } log.info(token); return { messageValue: token}; };
This token gets sent back to the client that called the method (from a callback), but the problem is that the "format" of token that is returned is not correct (contains other stuff): {"Value":"8jhxv9qk4isk1ckdrt0","LastUpdated":"2019-10-04T20:11:33.268Z","Permission":"Public"}
This is where I receive the result (token):
private void OnGetUserToken(ExecuteCloudScriptResult result) { JsonObject jsonResult = (JsonObject)result.FunctionResult; jsonResult.TryGetValue("messageValue", out object messageValue); UserToken = (string)messageValue; Debug.Log((string)messageValue); Debug.Log("OnGetUserToken token value set: " + (string)messageValue); }I need the thing in "Value" but I don't know how to get it... Is there anything to do with serialization?
I'd appreciate any help!
Thanks in advance!