> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bricks.tools/llms.txt
> Use this file to discover all available pages before exploring further.

# 驗證

> 登入您的 BRICKS 工作區並管理設定檔

BRICKS CLI 使用驗證設定檔連線到您的工作區。每個設定檔儲存一個與特定工作區關聯的 token。

## 登入

從 [BRICKS Controller](/zh-Hant/controller) 取得拋棄式通行碼，並用它登入：

```bash theme={null}
bricks auth login <passcode>
```

從您工作區的 **Manage API Tokens** 產生拋棄式通行碼。通行碼在 5 分鐘後過期，且只能使用一次。您也可以直接使用工作區 token 登入：

```bash theme={null}
bricks auth login-token -t <token>
```

從 [BRICKS Controller](/zh-Hant/controller/workspaces) 的 **Manage API Tokens** 產生或複製您的工作區 token。

## 設定檔

設定檔讓您管理多個工作區連線。每次登入都會建立或更新一個設定檔。

```bash theme={null}
# 登入並儲存至具名設定檔
bricks auth login <passcode> -p my-workspace

# 列出所有設定檔
bricks auth list

# 切換使用中的設定檔
bricks auth use <profile>

# 查看目前使用中的設定檔
bricks auth status
```

### 個別指令的設定檔覆寫

使用 `-ap` 或 `--auth-profile` 以不同設定檔執行任何指令，無需切換：

```bash theme={null}
bricks -ap staging device list
bricks --auth-profile production app list
```

**解析順序：** `--auth-profile` 旗標 > `BRICKS_PROFILE` 環境變數 > 已儲存的使用中設定檔。

## 登出

```bash theme={null}
# 移除目前設定檔的 token
bricks auth logout

# 移除指定的設定檔
bricks auth logout -p my-workspace

# 移除所有設定檔
bricks auth logout -a
```
