---
agentTools:
  projectIndex: https://regscale.readme.io/llms.txt
---

# Login

## RegScale Login CLI

The Login CLI command is used to allow a user to authenticate to RegScale.  It serves two primary purposes:

* Serves as a "smoke test" to ensure connectivity to RegScale
* Allows for authentication which sets the JSON Web Token (JWT) in the `init.yaml` programmatically which is good for up to 24 hours

## Supported Login Methods

* Login with a user account:
  * `--username` Your RegScale username, if none provided it will try to get it from the environment variable `REGSCALE_USER`
  * `--password` Your RegScale password, if none provided it will try to get it from the environment variable `REGSCALE_PASSWORD`
  * `--domain` Your RegScale instance URL, if none is provided it will try to get it from an environment variable `REGSCALE_DOMAIN`. Lastly, if there it is not provided, nor is it set up in the environment, it will use the domain saved in `init.yaml`
  * `--mfa_token` The One Time Password to log in with if your RegScale instance has Multi-Factor Authentication enabled
* Login with a Service Account
  * `--token` The service account token from the Admin panel in RegScale

### How to Use

> 📘 You can set up environment variables of REGSCALE\_USER, REGSCALE\_PASSWORD and REGSCALE\_DOMAIN to skip all prompts and prevent entering a plain text password.

* Ensure the `domain` variable is set in your `init.yaml` file to your RegScale instance's URL (i.e. `https://mycompany.regscale.com` )
* Attempt to login with the command below

```
regscale login
```

* At the prompts, enter your username and password
* If authentication was successful, your `init.yaml` will be updated with a new `token` and `userId` variable
* Login with a service token by using the command below

```
regscale login --token "Bearer eyao13.213asdajhd"
```