> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.pensar.dev/apex/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.pensar.dev/apex/_mcp/server.

# pensar login

> Connect to Pensar Console from the command line

## Overview

The `pensar login` command connects your CLI to [Pensar Console](https://console.pensar.dev) for managed inference. This is the headless equivalent of the TUI [`/login`](/apex/tui-slash-commands/login) command — it uses the same device authorization flow but runs entirely in the terminal without the TUI.

> **Note**
>
> The `pensar auth` command still works as an alias for backward compatibility, but `pensar login` is now the primary command name.

## Usage

```bash
pensar login [subcommand]
```

## Subcommands

| Subcommand            | Description                                                |
| --------------------- | ---------------------------------------------------------- |
| `pensar login`        | Start the login flow (or show status if already connected) |
| `pensar login status` | Show current connection status                             |
| `pensar login logout` | Disconnect from Pensar Console                             |

The legacy `pensar auth` command and subcommands still work for backward compatibility.

## Login Flow

```bash
pensar login
```

1. Apex requests a device code from the Pensar authentication service
2. A browser window opens to the verification URL
3. Enter the user code displayed in your terminal to confirm
4. Select a workspace. If your account has exactly one, it's selected automatically; if you have several, you'll be prompted to choose. If you have **none**, Apex opens your browser to create one and waits for it to be created.
5. Apex stores the auth tokens locally

If you're already connected, `pensar login` will show your current status and offer to reconnect.

## Checking Status

```bash
pensar login status
```

Displays your auth type (WorkOS or API key) and current workspace. When using API key auth, the command resolves your workspace from the server if it isn't already stored locally.

```
✓ Connected to Pensar Console
  Workspace: my-team (my-team)
  Auth: WorkOS
```

## Logging Out

```bash
pensar login logout
```

Clears stored authentication tokens from your local configuration. You can reconnect at any time by running `pensar login` again.

## Related Commands

#### [/login](/apex/tui-slash-commands/login)

Connect via the TUI with the same device flow

#### [pensar pentests](/apex/cli-commands/pensar-pentests)

List and dispatch pentests in your workspace (requires login)