# Authentication commands

Except for the [administration commands](cli-reference), all Akamas commands representing Akamas operation require authentication.

| Command           | Description |
| ----------------- | ----------- |
| [login](#login)   | login       |
| [logout](#logout) | logout      |

## Login

Login credentials can be passed as an argument to Akamas CLI:

```bash
akamas login -u <user> -p <password> -w <workspace>
```

* If the user, password, or organization are not specified as parameters, they will be asked via a prompt. Beware that passing the password as an argument makes it visible in the command line history. Therefore it should always be typed by the CLI secure prompt.
* If the workspace is specified and the user has access to it, it will be set as the default workspace for the session.
* If the login is successful, a message like the following will be printed: _\<username> logged in. Welcome."_
* If the login fails because the credentials are wrong or the user is not authorized to access, the error message "Login failed: Invalid user credentials" will be printed.

The fill reference for the Akamas login command is.

```
akamas login [-u|--user USERNAME] [-p|--password PASSWORD] [-w|--workspace WORKSPACE] [-o|--organization ORGANIZATION]
```

If one of the environmental variables is specified, the corresponding parameter will not be asked to the user. Workspace and Organization are not needed for login, they will not be asked even if not specified.

| Option         | Short | Description                                                                                                                                                     | Environment Variable | Required |
| -------------- | ----- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | -------- |
| --user         | -u    | The username to use to connect to Akamas. If not specified will be requested by prompt.                                                                         | AKAMAS\_USER         | no       |
| --password     | -p    | User password. If not specified will be requested by prompt. Be advise that if specified in the command line, the password will be visible in terminal history. | AKAMAS\_PASSWORD     | no       |
| --workspace    | -w    | Set a default workspace for the session. The user should have access to the workspace specified                                                                 | AKAMAS\_WORKSPACE    | no       |
| --organization | -o    | Set your organization                                                                                                                                           | AKAMAS\_ORGANIZATION | no       |

## Logout

When logged in, this command will log out the current user

```bash
akamas logout
```

On success the message "Logout successful." will be printed.

### Resources <a href="#clireference-resources" id="clireference-resources"></a>

| Akamas resources   | Parent Resource |
| ------------------ | --------------- |
| Component          | System          |
| Component Type     |                 |
| Metric             |                 |
| Parameter          |                 |
| Optimization Pack  |                 |
| Study              |                 |
| Step               |                 |
| Experiment         | Study           |
| Trial              |                 |
| Telemetry Provider |                 |
| Telemetry Instance | System          |
| KPI                | System          |
| License            |                 |
| Workflow           |                 |
| User               |                 |
| Workspace          |                 |
