# auth

> Sign in to a Nexus Gateway, check who you are, sign out, and manage your API keys.

Sign in to a Nexus Gateway, check who you are, sign out, and manage your API keys.

## nexus auth login

```sh
nexus auth login --url <core>
nexus auth login --with-token
```

Sign in as you, in your organization: approve a one-time code in Nexus UI (--no-browser to only print the link).

- `nexus auth login --with-token`: Sign in with an API key read from stdin, for CI and scripts.

| Option | Meaning |
| --- | --- |
| `--url <core>` | The Gateway to sign in to, saved as the default (default: NEXUS_GATEWAY, else the saved one, else NEXUS_URL, else https://api.nexus.inc) |
| `--no-browser` | Only print the approval link; do not open a browser |
| `--with-token` | Read an API key from stdin instead of signing in through the browser |

```sh
nexus auth login --url https://api.nexus.inc
```

## nexus auth signup

```sh
nexus auth signup --name <name> [--email <email>] [--dry-run]
```

Create an organization and its owner without a browser, and save the new API key (when key-only signup is enabled).

| Option | Meaning |
| --- | --- |
| `--name <name>` | The new organization's name (1 to 80 characters) |
| `--email <email>` | The owner's email address (unverified until verified through sign-in) |
| `--dry-run` | Show what would change, change nothing |

## nexus auth status

```sh
nexus auth status
```

Your org, user and role, the Gateway URL, your token (masked) and whether Gateway accepts it.

| Exit code | Meaning |
| --- | --- |
| 0 | Signed in, and Gateway accepts the token |
| 1 | Not signed in, or Gateway rejects the saved token |

```sh
nexus auth status --json
```

## nexus auth logout

```sh
nexus auth logout
```

Revoke the saved token on Gateway and forget it.

## nexus auth delete-account

```sh
nexus auth delete-account [--dry-run] [--confirm DELETE]
```

Delete your account for good: your sign-in, your personal organization and your place in every organization.

| Option | Meaning |
| --- | --- |
| `--dry-run` | Show what would change, change nothing |
| `--confirm <DELETE>` | DELETE, to confirm without a terminal (on one, you type it when asked) |

## nexus auth tokens list

```sh
nexus auth tokens list [--all]
```

Your API keys and CLI sign-ins in this organization, newest first (--all: everyone's, owners and admins).

| Option | Meaning |
| --- | --- |
| `--all` | Everyone's tokens in the organization (owners and admins) |

## nexus auth tokens create

```sh
nexus auth tokens create --label <label>
```

Create a personal API key for CI and scripts: it acts as you, with your role, and it is shown once.

| Option | Meaning |
| --- | --- |
| `--label <label>` | A name for the key (1 to 80 characters), to tell keys apart |

```sh
nexus auth tokens create --label "CI deploys"
```

## nexus auth tokens revoke

```sh
nexus auth tokens revoke <id>
```

Revoke one of your tokens at once (owners and admins: anyone's).
