# gt: General Translation CLI tool: gt login
URL: https://generaltranslation.com/en-GB/docs/cli/reference/commands/login.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Sign in to your account for hosted CLI workflows. API reference for the gt login command.

Use login to authenticate an existing setup. For guided project setup, run [`gt init`](/docs/cli/reference/commands/init); it signs you in when it creates a project or key and no tooling key or saved login is available. To create a scoped key, use [`gt api-key create`](/docs/cli/reference/commands/api-key-create).

## Overview [#overview]

Requires [Node.js 20 or later](/docs/cli/quickstart#quickstart); a currently supported LTS release is recommended.

```bash
npx gt login [options]
```

| Parameter                       | Description                                                   | Type      | Optional | Default          |
| ------------------------------- | ------------------------------------------------------------- | --------- | -------- | ---------------- |
| [`--no-browser`](#flags)        | Use device authorisation instead of a local browser callback. | `boolean` | Yes      | `false`          |
| [`-c, --config <path>`](#flags) | Config file whose `baseUrl` selects the API to sign in to.    | `string`  | Yes      | `gt.config.json` |

<Callout type="info">
  **Changed in v2.22:** the former auth command and its key-type flag have been removed, not kept as aliases. Login replaces account sign-in; init and explicit key creation handle provisioning. Existing API keys can still be used.
</Callout>

## How it works [#how-it-works]

* Opens your browser so that you can approve CLI access to your account.
* Your account permissions determine which projects and operations you can access.
* Uses device authorisation with `--no-browser`, or if it cannot listen for the browser callback on this machine. It displays a verification URL and code to approve on another device.
* Uses device authorisation automatically in SSH sessions. A failed browser launch alone does not switch modes; open the displayed authorisation URL yourself, or rerun with `--no-browser`.
* Saves an account session, not a project selection. It does not create API keys or write `.env.local`. Runtime SDKs do not load CLI sessions.

For project binding, explicit-key precedence and CI credentials, see [Configuring the CLI](/docs/cli/guides/configuring#credentials).

## Flags [#flags]

**`--no-browser`** · **Type** `boolean` · **Optional** · **Default** `false`

Uses device authorisation without opening a browser. Human approval is still required; this is not unattended CI authentication.

**`-c, --config <path>`** · **Type** `string` · **Optional** · **Default** `gt.config.json`

Reads [`baseUrl`](/docs/cli/reference/config#base-url) from this config file instead of the discovered `gt.config.json`. `GT_API_URL` still overrides it. Requires `gt` 2.23.0 or later.

The [global options](/docs/cli/reference/global-options) also apply.

## Examples [#examples]

```bash
# Sign in using a browser on this machine
npx gt login

# Approve sign-in on another device
npx gt login --no-browser
```

After approval, check the account with [`gt whoami`](/docs/cli/reference/commands/whoami). Use [`gt logout`](/docs/cli/reference/commands/logout) to remove the saved session.

## Storage and troubleshooting [#storage]

Sessions are stored at `$XDG_STATE_HOME/gt/credentials.json` when `XDG_STATE_HOME` is absolute, otherwise at `~/.local/state/gt/credentials.json`. Relative XDG values are ignored.

Credentials use owner-only file permissions where supported; they are not encrypted or stored in an OS keychain. Older saved-login formats are not migrated automatically. Sign in again if your saved credentials are out of date or invalid. Corrupt credential files are preserved as `.corrupt-<timestamp>` backups.

The CLI keeps you signed in between commands. Avoid updating the same saved login from multiple CLI processes at once.

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
