question

entelicon avatar image
entelicon asked

PlayFabServerAPI.GetUserData returning error

GetUserDataRequest getData = new GetUserDataRequest();
            getData.PlayFabId = player.playfabID;
            List<string> keys = new List<string>();
            keys.Add("Engine");
            keys.Add("Chassis");
            keys.Add("Body");
            keys.Add("Wheel");
            getData.Keys = keys;


PlayFabServerAPI.GetUserData(getData, (result) => {
                Debug.Log("Engine: " + result.Data ["Engine"].Value);
                Debug.Log("Base: " + result.Data ["Base"].Value);
                Debug.Log("Chassis: " + result.Data ["Chassis"].Value);
                Debug.Log("Wheel: " + result.Data ["Wheel"].Value);
            }, (error) => {
                Debug.Log(error);
            });

I'm trying to "mimic" a server inside of Unity to build the project.

When I'm trying to retrive the data from a player, it gives me the error:
PlayFabError(NotAuthenticated, Missing or invalid X-SecretKey HTTP header, 401 Unauthorized)

I'm not sure where to set the Secret Key as I thought the Editor Extension already did that for me.

Any help would be great, thanks!

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

·
brendan avatar image
brendan answered

What version of the PlayFab Unity SDK are you using? Also, can you confirm that you've set up the Secret Key according to the instructions in the readme (https://github.com/PlayFab/UnitySDK)?

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.