I try to follow service account authentication doc to generate service account credential(base64 of key + secret) and used it to call ugc api, but most apis that need to be authenticated fail.
curl -X PUT \
-H "Authorization: Basic <service-account-credential>" \
https://ugc.services.api.unity.com/v1/projects/:projectId/environments/:environmentId/content/:contentId/visibility
Calling with proper variable substitution will result failiure
I also tried to do token-exchange, but I don’t know what scope should I use. Tried with “user_generated_content.admin.all” but it does not work, I keep getting
{
"name": "AuthorizationError",
"message": "The service account does not have access to all of the requested scopes.",
"status": 403,
"code": 53,
"type": "https://services.docs.unity.com/docs/errors/#53"
}
But using “remote_config.configs.create”, “multiplay.allocations.create”, etc. as scopes will get me the token.
Not sure what to do at this point, as I just want to make ugc content upload during editor time. Since sdk seems only can be used at runtime, I am thinking to use api directly during editor script. But none of the api that requires auth can be used.
When using a service account, you can only access endpoints from the Service Gateway (Admin API)
In your example, you are trying to access an endpoint in the Game Gateway (Client API)
While investigating I found that we were providing the wrong URL for our Admin API docs, which might be why you got confused. It will be fixed shortly.
We’ve tried with a service account and we get ‘Not authenticated error’
When we try with a client account, the IAuthenticationService interface has no TokenID as described here.
The question:
When Unity says this is a Client API, should we be using a service account or client auth like ‘AuthenticationService.Instance.SignInAnonymouslyAsync’?