# Login

> Safely stores the Service Account Key ID and Secret key locally.

Safely stores the Service Account Key ID and Secret key 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 enter your service account `key-id` and `secret-key`.

```text
ugs login
Enter your key-id: <your-key-id>
Enter your secret-key: <your-secret-key>
```

## 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.

```text
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-id   | The key-id of your service account. Must be used with "--secret-key-stdin".    |
| secret-key | --secret-key-stdin | The secret-key of your service account. Must be used with  "--service-key-id". |
| help       | -?, -h, --help     | Display help and usage information.                                            |
| quiet      | -q, --quiet        | Reduce logging to a minimum.                                                   |
| json       | -j, --json         | Use 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 follow an order of priority for authentication:

`local configuration` > `Service Account Key ID and Secret key environment variables`
