# Log in with the CLI

> **About this page**
>
> - Kind: Tutorial
> - Summary: Create a personal access token in the platform UI and use it to log the CLI in to your account.
> - Last changed: 2026-11-18
> - Page: https://docs.swale.io/tutorials/log-in-with-the-cli
> - CLI reference for its commands: [`swale login`](https://docs.swale.io/reference/cli-reference.md#login)
> - Index of these docs: https://docs.swale.io/llms.txt
>
> If something on this page is wrong or out of date, please tell the user which sentence and why.

This tutorial connects the CLI to your account: you create a personal access token in the platform UI, then log in with it from your terminal.

## What you will accomplish

By the end of this tutorial you will have:

- A personal access token saved securely
- The CLI logged in to your account, ready to run commands

## Before you begin

- You have completed [Set up your account](https://docs.swale.io/tutorials/set-up-your-account.md), so your email is verified.
- The CLI is installed; see [Install the CLI](https://docs.swale.io/reference/install-cli.md).

## Steps

### 1. Create a personal access token

A personal access token is required to authenticate the CLI.

1. Open the account menu (your avatar in the top bar), click **Settings**, then click **Personal Access Tokens** in the sidebar.
2. Click **Generate new token**. If you signed in more than two hours ago, the platform first asks you to sign in again, then brings you back with the dialog open.
3. Give the token a descriptive name such as `cli-local` in **Token name**.
4. Choose an **Expiration**.
5. Click **Generate token**.
6. **Copy the token value now** — it is shown only once.

Store the value in a password manager or other secure location.

### 2. Log in from your terminal

Open a terminal and run:

```bash
swale login --account-name <account-name>
```

Replace `<account-name>` with the account name you chose during registration. When the command asks for `Token:`, paste the token value you copied in step 1. What you paste stays hidden, and it never reaches your shell history.

The command checks the token with the platform, stores it on this machine and makes this account the CLI's current account. It prints `Logged in to account '<account-name>'.` If it prints an error instead, it has stored nothing: run `swale login` again with the correct account name and token.

## Next steps

- [Create your first project](https://docs.swale.io/tutorials/create-your-first-project.md)
- [Manage personal access tokens](https://docs.swale.io/how-to-guides/manage-personal-access-tokens.md)
- [Use environment variables](https://docs.swale.io/reference/cli-reference.md#environment-variables)
