Documentation

Unity Gaming Services CLI


GitHub Repository

Unity Gaming Services CLI


Login

Log in with Unity Hub or a service account.
Read time 2 minutesLast updated 3 days ago

Log in with Unity Hub or a service account. Service account credentials are stored locally.
Note
This is a base command specific to the CLI that allows you to make authenticated calls to our apis. It is not related to the Authentication Unity Service.

Interactive usage

By default, calling this command prompts you to choose a login method:
Unity Hub
or
Service Account
. Choosing
Service Account
prompts you to enter your service account
key-id
and
secret-key
.
ugs loginChoose a login method: Service AccountEnter your key-id: <your-key-id>Enter your secret-key: <your-secret-key>

Unity Hub

Log in with the account signed in to Unity Hub. Unity Hub must be running and signed in.
ugs login --unity-hub
--unity-hub
can't be combined with the service account options. To use Unity Hub authentication for a single call without logging in, set
UGS_CLI_USE_HUB_AUTH
to
true
.

Automated usage

You can automate login by using both the
--service-key-id
option and the
--secret-key-stdin
option.
The
--service-key-id
option expects your service account
key-id
as argument.
The
--secret-key-stdin
option expects your
secret-key
in the standard input.
ugs login --service-key-id "your-key-id" --secret-key-stdin < "secret-key-file"
Where
"your-key-id"
is your service account
key-id
, and
"secret-key-file"
is the path to a file containing your service account
secret key
.

Options

Alias

Description

key-id--service-key-idThe key-id of your service account. Must be used with "--secret-key-stdin".
secret-key--secret-key-stdinThe secret-key of your service account. Must be used with "--service-key-id".
unity-hub--unity-hubLog in with Unity Hub.
help-?, -h, --helpDisplay help and usage information.
quiet-q, --quietReduce logging to a minimum.
json-j, --jsonUse JSON as the output format.

Environment Variables

Logging in with Environment Variables

To log in manually use the
ugs login
command.
To log in with system environment variables, set
UGS_CLI_SERVICE_KEY_ID
and
UGS_CLI_SERVICE_SECRET_KEY
to your system's environment variables.
Authenticated calls use the first available credential, in this order:
  1. UGS_CLI_AUTH_TOKEN
    (a bearer token)
  2. UGS_CLI_USE_HUB_AUTH
    (Unity Hub)
  3. The credential saved by
    ugs login
  4. UGS_CLI_SERVICE_KEY_ID
    and
    UGS_CLI_SERVICE_SECRET_KEY