Skip to content
Gates

Sign in and sessions

login

gates login

The CLI asks the API for a one-time code, prints it, and opens the dashboard’s /device page in your browser with the code filled in. Confirm it there while signed in to your account. The CLI polls until you do, then prints who it is signed in as.

✓ Requesting a sign-in code
┌──────────────────────────────────────────────────────┐
│ Confirm this code in your browser                    │
│                                                      │
│   TWJX-9KQ4                                          │
│                                                      │
│   https://app.usegates.app/device?user_code=TWJX9KQ4   │
└──────────────────────────────────────────────────────┘
✓ Waiting for approval

This is the OAuth device grant. The browser does the authentication, so the CLI never sees a password, and a coding agent running the CLI never can either. If the browser does not open, paste the URL yourself. The code expires after fifteen minutes; run login again for a new one.

What the CLI holds afterwards is an ordinary session for your account, the same kind the dashboard holds, valid for seven days. It is listed under Settings → Account with your other sessions and can be revoked there.

--api-url <url> points the CLI at another API, for a self-hosted or local Gates. The URL is saved with the session.

whoami

gates whoami

The account, the API it talks to, and a table of the workspaces you belong to with your role in each. When nothing is signed in it exits 1 with the login command as the hint; the agent skill runs this first and stops if it fails.

logout

gates logout

Revokes the session on the server and deletes the credentials file. A token copied elsewhere stops working at the same moment.

Tokens for CI

GATES_TOKEN and GATES_API_URL override the saved session, so a job can run the CLI without a browser:

GATES_TOKEN=$GATES_TOKEN npx @withgates/cli flags kill new-checkout --project $PROJECT_ID

Get a token with gates login on your machine and read it from ~/.config/gates/credentials.json. It is a session for your account with everything your account can do, so treat it like a password: keep it in the CI secret store, and revoke it from Settings → Account when the job is retired.