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:
- 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_TOKENenvironment variable with a token generated in your Qoder settings.
/loginis 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:
CIis set;BROWSER=www-browser;DEBIAN_FRONTEND=noninteractive;- inside an SSH session (
SSH_CONNECTION); - on Linux, none of
DISPLAY,WAYLAND_DISPLAY, orMIR_SOCKETis set.
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:
If you have both set theQODERCN_PERSONAL_ACCESS_TOKENenvironment 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.
Authentication-related environment variables
| Environment variable | Description |
|---|---|
QODERCN_PERSONAL_ACCESS_TOKEN | Personal Access Token; when set, PAT authentication is used automatically |
QODERCN_CONFIG_DIR | Custom 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:
If you authenticated via the/logoutis also available under the alias/signout; you will be asked to confirm before signing out.
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.