Skip to main content
Getting started

Sign-in and Authentication

Overview

You need to authenticate before using Qoder. The first time you run a command, Qoder CLI CN automatically prompts you to sign in. Qoder CLI CN uses Qoder's own authentication system and offers two main authentication methods:
  • Interactive sign-in (recommended): sign in from the terminal via browser or by pasting a token — suitable for everyday local use.
  • Environment variable: authenticate with a Personal Access Token — suitable for CI/CD pipelines and browserless automated environments.

Interactive sign-in

Start Qoder CLI CN in your terminal, then type /login at the interactive prompt:
# Start Qoder CLI CN in your terminal
qodercn

# At the interactive prompt, type /login
/login
Then choose your preferred sign-in method:
  • Login with Qoder Platform (Browser): opens a browser window to authenticate with your Qoder account.
  • Use Qoder Personal Access Token (QODERCN_PERSONAL_ACCESS_TOKEN): set the QODERCN_PERSONAL_ACCESS_TOKEN environment variable with a token generated in your Qoder settings.
After you make a choice, Qoder CLI CN guides you through the remaining steps.
/login is also available under the alias /signin.

When the browser cannot open automatically

In environments without a graphical interface, Qoder CLI CN automatically skips launching the browser; the sign-in screen prints the login URL directly, and you can copy it into a browser manually to complete authentication. An environment is treated as headless if any of the following holds:
  • CI is set;
  • BROWSER=www-browser;
  • DEBIAN_FRONTEND=noninteractive;
  • inside an SSH session (SSH_CONNECTION);
  • on Linux, none of DISPLAY, WAYLAND_DISPLAY, or MIR_SOCKET is set.
So no extra configuration is needed on remote servers, in containers, or in CI environments. If the browser fails to open, you can likewise copy the URL printed on screen manually.

Automatic token refresh

After you sign in via the browser, Qoder CLI CN refreshes the token automatically in the background — no manual re-login is needed for everyday use.

Using a Personal Access Token

For non-interactive sessions or automated environments (such as CI/CD pipelines), you can authenticate with a Personal Access Token (PAT).

Get a token

Create and manage Personal Access Tokens on this page:
https://qoder.cn/account/integrations

Authenticate via environment variable

Set the token in the QODERCN_PERSONAL_ACCESS_TOKEN environment variable:
# Linux / macOS example
export QODERCN_PERSONAL_ACCESS_TOKEN="your_personal_access_token_here"
# Windows example (Command Prompt) — do not add quotes; CMD stores quotes as part of the value
set QODERCN_PERSONAL_ACCESS_TOKEN=your_personal_access_token_here
# Windows example (PowerShell)
$env:QODERCN_PERSONAL_ACCESS_TOKEN="your_personal_access_token_here"
Once set, Qoder CLI CN automatically authenticates with the PAT.
If you have both set the QODERCN_PERSONAL_ACCESS_TOKEN environment variable and signed in via /login, authentication prefers the PAT in the environment variable. To switch to the credentials saved by /login, you must clear that environment variable first.
Environment variableDescription
QODERCN_PERSONAL_ACCESS_TOKENPersonal Access Token; when set, PAT authentication is used automatically
QODERCN_CONFIG_DIRCustom config directory; default ~/.qoder-cn

Check authentication status

Type /status in an interactive session to open the status panel, which has two tabs — Usage and Status. Usage shows the current session's API quota and token usage (plan type, quota consumption, session duration, code change volume, etc.); Status shows the current CLI status information. When you suspect an authentication problem, this is the most direct place to check.

Sign out

To sign out of Qoder, type /logout at the interactive prompt:
# At the interactive prompt, type /logout
/logout
/logout is also available under the alias /signout; you will be asked to confirm before signing out.
If you authenticated via the QODERCN_PERSONAL_ACCESS_TOKEN environment variable, you must clear that variable before running /logout; otherwise the next launch will automatically sign in with that token again.

FAQ

  • Browser did not open automatically: in headless environments the CLI skips launching the browser; manually copy the URL printed on the sign-in screen into a browser.
  • Login callback fails or hangs: make sure your local network can reach Qoder services; check proxy settings if necessary — see Network, Proxy, and VPC.
  • PAT invalid or expired: regenerate a token on the account integrations page and update QODERCN_PERSONAL_ACCESS_TOKEN.
For more troubleshooting steps, see Sign-in and Authentication Issues.