# Get Authenticated

> Log in with Unity Hub, or with a Service Account for automated environments such as CI.

There are two ways to log in: with Unity Hub, or with a Service Account.

## Logging in with Unity Hub

If Unity Hub is running and signed in, run `ugs login --unity-hub`. No Service Account is needed.

See [Unity Hub login] for details.

## Logging in with a Service Account

Use a Service Account when Unity Hub isn't available, for example in CI.

### Creating a Service Account

In the `Projects` tab, in the `Service Accounts` section, you can create a service account. For authenticating CLI calls, we need the following:

* Your Service Account key ID
* Your Service Account secret key

Additionally, you may need to add permissions to your Service Account to allow it to modify your projects. To do this, click on your Service Account and add a project role. From there, you can choose a project and permissions.

For more information on Service Accounts, refer to the [Service Account Authentication] documentation.

### Logging in

See how to [Login Using a Command] or [Logging in With Environment Variables].

[Unity Hub login]: ./../base-commands/login#unity-hub

[Service Account Authentication]: https://services.docs.unity.com/docs/service-account-auth

[Login Using a Command]: ./../base-commands/login

[Logging in With Environment Variables]: ./../base-commands/login#logging-in-with-environment-variables
