# Add a sign-in to your quest

> Let the player sign in to a tool (Claude, ChatGPT, GitHub…) from their own browser, prove it, and go on. Five templates, one command.

A sign-in step signs the player in to a tool's own command line (Claude Code, Codex, GitHub CLI…) **from the browser they are looking at**, even when the game runs on another machine (a VM, a server). The game runs the tool's own sign-in, shows its link in the page, takes back what the player must give (a code, a token), and proves the sign-in by asking the tool itself. Your pack only declares data: the programs, their arguments and the hosts a link may point at are a closed list in the game's code.

## Quickstart: 30 seconds

Create a quest with a ready-made sign-in step, then check it.

```sh [Terminal]
alta new signin my-sign-in --template link-code
alta lint my-sign-in
```

```text [Output]
created my-sign-in/quests.json (signin, id my-sign-in)
next: edit the texts, then `alta lint my-sign-in`, then `alta dev my-sign-in`
```

```text [Output]
ok   my-sign-in/quests.json (quests)
1 checked, 0 errors, 0 warnings
```

That is a whole sign-in: the step, its action and its proof. Change the texts, or pick another template below with `--template`, and another tool with `--tool`.

## Choose a template

| Template | What the player does | Tools that offer it |
|---|---|---|
| [`link-code`](#link-code) | Opens a link in their browser, signs in, pastes the code it shows back in the page. | `claude` |
| [`device-code`](#device-code) | Opens a link and types there a short code shown in the page. Nothing to paste. | `codex`, `gh` |
| [`email-link`](#email-link) | Confirms an e-mail in their browser. Nothing to paste. | `practice` |
| [`secret`](#secret) | Types a token in a password field of the card. | `codex`, `gh` |
| [`tool-browser`](#tool-browser) | Signs in through the tool's own Terminal window and browser, on their own Mac. | `claude`, `codex`, `gh` |

The full list of tools, their flows and hosts is in the reference: [sign-in tools](https://docs.altasystem.ai/reference/standards/executors#signin-tools). `practice` is a practice program for examples and tests: it never signs in to a real account.

## Link and pasted code

The tool prints a sign-in link and waits for a code. The game shows the link as a button that opens a new tab of the player's own browser, and a field for the code. Claude Code signs in this way.

```json [quests.json]
{
  "id": "sign-in",
  "kind": "action",
  "title": { "en": "Sign in to Claude", "fr": "Connecte-toi à Claude" },
  "hint": {
    "en": "In your own browser: paste here the code the page gives you",
    "fr": "Dans ton propre navigateur : colle ici le code que la page te donne"
  },
  "run": {
    "do": "signin.cli",
    "args": {
      "tool": "claude",
      "flow": "link-code",
      "hosts": "claude.ai,claude.com,platform.claude.com,console.anthropic.com"
    }
  },
  "check": { "type": "signin", "tool": "claude" }
}
```

![The step while it runs: "Open the Claude sign-in page", then "Paste the code Claude gives you" and "Send the code"](https://docs.altasystem.ai/shots/signin-claude-link-code.png)

- The link is shown only if it is `https`, has no user or port, and points at a host of `hosts`, itself a subset of the tool's own hosts. Any other link stops the run.
- The code is a secret: a password field, sent once to the player's own server, written to the program's standard input, never logged or saved, never sent back to the page. The field is cleared after each send.
- A code that is cut short, or a web address instead of the code, is said in one sentence and the field stays. A refused or expired code ends the run with **Try again**, for a new link.

## Device code

The tool prints a link and a short code. The player opens the link and types the code there; the tool sees it by itself. Codex (`codex login --device-auth`) and the GitHub CLI sign in this way.

```json [quests.json]
{
  "id": "sign-in",
  "kind": "action",
  "title": { "en": "Sign in to GitHub", "fr": "Connecte-toi à GitHub" },
  "hint": {
    "en": "In your own browser: type there the code shown here",
    "fr": "Dans ton propre navigateur : tape là-bas le code affiché ici"
  },
  "run": {
    "do": "signin.cli",
    "args": {
      "tool": "gh",
      "flow": "device-code",
      "hosts": "github.com"
    }
  },
  "check": { "type": "signin", "tool": "gh" }
}
```

![A link button, then the code WXYZ-1234 with Copy, and "nothing to paste here"](https://docs.altasystem.ai/shots/signin-practice-device-code.png)

- The page shows the link (checked like above) and the code, never anything else the tool prints.
- Nothing goes back from the page: the run ends when the tool says it is done, then the proof is read.
- Codex asks for device sign-in to be turned on in the player's ChatGPT settings first.

## E-mail link

The tool sends an e-mail and waits. The player confirms in their browser; the tool sees it by itself.

```json [quests.json]
{
  "id": "sign-in",
  "kind": "action",
  "title": {
    "en": "Sign in to Alta Practice",
    "fr": "Connecte-toi à Alta Practice"
  },
  "hint": {
    "en": "Confirm the e-mail in your own browser",
    "fr": "Confirme l'e-mail dans ton propre navigateur"
  },
  "run": {
    "do": "signin.cli",
    "args": {
      "tool": "practice",
      "flow": "email-link",
      "hosts": "signin.example.com"
    }
  },
  "check": { "type": "signin", "tool": "practice" }
}
```

![A line that says to open the e-mail, and an "Open the page" button](https://docs.altasystem.ai/shots/signin-practice-email-link.png)

- If the tool prints a page to open, it is checked against `hosts` like any link.
- Only the `practice` program offers this flow today: a real tool joins it when the game adds it to its list.

## Password or token

The player types a token in a password field of the plan card. It goes with the agreement to the player's own server, then to the tool's standard input, and is erased.

```json [quests.json]
{
  "id": "sign-in",
  "kind": "action",
  "title": { "en": "Sign in to GitHub", "fr": "Connecte-toi à GitHub" },
  "hint": {
    "en": "Your token goes only to your own server, then to the program",
    "fr": "Ton jeton va seulement à ton propre serveur, puis au programme"
  },
  "inputs": [
    {
      "id": "token",
      "kind": "secret",
      "label": {
        "en": "Your GitHub token",
        "fr": "Ton jeton GitHub"
      }
    }
  ],
  "run": {
    "do": "signin.cli",
    "args": {
      "tool": "gh",
      "flow": "secret",
      "token": { "input": "token" }
    }
  },
  "check": { "type": "signin", "tool": "gh" }
}
```

![A password field "Your Alta Practice token" and "Sign in"](https://docs.altasystem.ai/shots/signin-practice-secret.png)

- `token` must name a `secret` input of the step: never a literal value in the pack.
- The token is never in the command line, a URL, a log, the save or the run's journal, and never sent back to the page.
- A refused token ends the run with one sentence and **Try again**.

## The tool's own sign-in, on the player's Mac

The tool runs its own sign-in in a Terminal window of the player's Mac, and opens the browser there. Use it only for a step played on the player's own Mac, with a screen: `"host": "local"`.

```json [quests.json]
{
  "id": "sign-in",
  "kind": "action",
  "title": { "en": "Sign in to Claude", "fr": "Connecte-toi à Claude" },
  "hint": {
    "en": "In a Terminal window and the browser of this Mac",
    "fr": "Dans une fenêtre Terminal et le navigateur de ce Mac"
  },
  "host": "local",
  "run": {
    "do": "signin.cli",
    "args": { "tool": "claude", "flow": "tool-browser" }
  },
  "check": { "type": "signin", "tool": "claude" }
}
```

![The plan card: a Terminal window that runs the tool's own sign-in](https://docs.altasystem.ai/shots/signin-practice-tool-browser.png)

- Nothing passes through the game: the player types in the tool's own window.
- On a Mac with a screen, the other templates also offer **Use a Terminal window on this Mac instead**. In a hosted world or on a server, only the page is offered.

## The proof

Every template proves the sign-in with a `signin` check of the same tool. It runs the tool's own status command (`claude auth status`, `gh auth status`…) and reads only whether the player is signed in: never a token, an e-mail or an account name. A step whose run ends without the proof is not done.

```json [quests.json]
"check": { "type": "signin", "tool": "gh" }
```

`mind` (`claude` or `codex`) is still read, for packs written before `tool`.

## What the game guarantees

- **Constant commands.** The program and its arguments come from the game's list for that tool and flow, never from your pack. The browser of the game's machine is never opened by the page flows.
- **Checked links.** A link reaches the page only if it is `https` and its host is in the step's `hosts` and the tool's own list.
- **Secrets stay on the player's server.** A code or a token goes from the page to the player's own server (a token and the exact address are checked, HTTPS when hosted), then to the program's standard input. Nothing else keeps it.
- **Bounded in time.** A sign-in that waits too long ends by itself with a sentence; **Cancel** ends it at once.

## Run the examples

`examples/signin/practice.fragment.json` holds one quest per template, played with the `practice` program. The repository's end-to-end tests play all five and take the screenshots of this page.

```sh [Terminal]
alta lint examples/signin/practice.fragment.json
```

```text [Output]
ok   examples/signin/practice.fragment.json (quests)
1 checked, 0 errors, 0 warnings
```

## Then point OpenClaw at the mind

Signing in to Claude or ChatGPT is not enough for OpenClaw to think with it. Add a step with `setup.claude-signin` (or `setup.openai-signin`), proven by a `model` check:

```json [quests.json]
{
  "id": "connect",
  "kind": "action",
  "title": { "en": "Connect OpenClaw to ChatGPT", "fr": "Branche OpenClaw sur ChatGPT" },
  "host": "local",
  "run": { "do": "setup.openai-signin", "args": {} },
  "check": { "type": "model", "mind": "codex" }
}
```

When an earlier step lets the player choose a mind, show each sign-in for its choice only: `"when": { "answer": "answers.wake.mind", "equals": "codex" }`.

## When alta lint refuses

| Rule | It means |
|---|---|
| [`signin.tool`](https://docs.altasystem.ai/reference/errors#signin-tool) | The tool is not in the game's list. |
| [`signin.flow`](https://docs.altasystem.ai/reference/errors#signin-flow) | The tool does not offer that flow. |
| [`signin.hosts`](https://docs.altasystem.ai/reference/errors#signin-hosts) | A link flow without `hosts`, a host the tool does not use, or `hosts` on a flow without a link. |
| [`signin.token`](https://docs.altasystem.ai/reference/errors#signin-token) | `secret` without a secret input, or a token on another flow. |
| [`signin.proof`](https://docs.altasystem.ai/reference/errors#signin-proof) | The step has no `signin` check of the same tool. |
| [`check.signin`](https://docs.altasystem.ai/reference/errors#check-signin) | The check names no tool, or both `tool` and `mind`. |

**Next:**

- [signin.cli in the reference](https://docs.altasystem.ai/reference/standards/executors#signin-cli)
- [Make a step act](https://docs.altasystem.ai/guides/quests/run-actions)
- [Prove a step with a check](https://docs.altasystem.ai/guides/quests/prove-with-checks)
