#Cloud Services API
1 messages · Page 1 of 1 (latest)
You can see the example here
something like this should work
IAdminClient client = ApiService.CreateAdminClient();
IPlayerAuthenticationAdminApi api = client.PlayerAuthentication;
var playerList = await api.ListPlayers(CloudProjectId);
The code for the Accounts sample are here com.unity.services.apis\Editor\Sections\Accounts
thanks, that's almost working but when I view Debug.Log(playerList.Content) I get a 401 error saying I don't have a token
Also how do you get to that API Samples window you've screenshotted there? I can't find it anywhere
Services -> API Samples
haha oops. Thanks!
Does it also require this service account authentication? https://services.docs.unity.com/docs/service-account-auth/
I assume that's why I'm getting a 401 error 51
None of the terminal steps described on that page are working - they just result in zsh: parse error near `\n'
No, that one uses the admin client. Make sure the settings tab in the sample has all the correct keys set up
I take that back. Looks like it does. Plus you'll need to add some defines
https://docs.unity3d.com/Packages/com.unity.services.apis@1.1/manual/index.html#availability-3
Ok so I've set up all the keys etc, and I can get the list via the Services API Examples window like in your screenshot
And I found the AccountsController which corresponds to that - so surely there must be some simple way of copying the AccountsController script's functionality to a Monobehaviour? If that can do it without terminal authorization then surely it's not needed?
No, you don't need the terminal at all. The id and secret for the service account are set in the Editor.
Thanks, I worked it out
The important step I was missing (and was really buried in the Service samples) was using "adminClient.SetServiceAccount" to input the key / secret key
Thanks for all your help!
Ah right. Yea, I'm not a fan of the MVC pattern for just this reason. I makes digging through the code a pain