Skip to content

Sign in

The CLI signs in through the dashboard. It shows you a code, you approve that code in your browser, and the CLI gets a session that lasts 30 days.

Terminal window
jiayang login

The CLI opens your browser at the approval page and prints the same address:

To sign in, open https://app.jiayang.cloud/device and enter this code:
PWDS-QSHX
Check the page shows this computer before you approve. Waiting...

In the browser:

  1. Sign in to the dashboard if you aren’t already. You type your email address and get a six-digit code by email, which works for ten minutes. There is no password. The first time, the dashboard asks you to agree to the terms of service, the privacy policy, the Data Processing Addendum and the refund policy. It won’t approve a CLI sign-in until you have, since nothing the CLI does would work before then.
  2. Type the code from your terminal.
  3. Check the request. The page shows the device, named after your computer (for example, “jiayang CLI on ada-laptop”), where the request came from, and where you are. If those two places differ, it says This request came from somewhere else.
  4. Choose Approve.

Approving needs a dashboard sign-in from the last 15 minutes. If yours is older, the dashboard asks you to sign in again first.

A code works once, for 10 minutes. One that’s mistyped, used or older gets No sign-in is waiting for that code. Run jiayang login again for a new one.

The CLI checks every five seconds and picks up the approval:

Signed in as ada@example.com. This session lasts 30 days.
You're not in a workspace yet. Make one to deploy into with `jiayang workspace create <slug>`, adding `--name` for a display name.

If you’re already in a workspace, the second line lists them instead:

Signed in as ada@example.com. This session lasts 30 days.
Your workspaces: acme.

Next, create a workspace and deploy.

Terminal window
jiayang login --no-browser

The CLI prints the address and the code without trying to open a browser. Open the address on any device where you can sign in, such as your laptop. The approval page flags the request as coming from somewhere else, which is expected here.

The code works for ten minutes. If nobody approves it in time:

error: the sign-in code expired before it was approved: run `jiayang login` again

If you choose Deny:

error: the sign-in was denied

Run jiayang login again to get a new code.

Terminal window
jiayang whoami
ada@example.com
acme (owner, free plan)

Each workspace line shows your role in it and its plan. With no workspace yet, the line under your email says to make one with jiayang workspace create <slug>. Add --json for the same thing as JSON, including when the session ends:

Terminal window
jiayang --json whoami

A CLI session lasts 30 days. When it has less than three days left, every command warns you before its own output:

Your session ends in 40 hours: run `jiayang login` to start a new one.

With --json the warning is a line of JSON on stderr instead, the way an error is:

{"warning":{"code":"session_ending","message":"Your session ends in 40 hours: run `jiayang login` to start a new one."}}

Running jiayang login again starts a new session and ends the old one on this computer.

Once a session has ended, or has been revoked, commands fail with:

error: your session has ended (signed out, revoked or expired): run `jiayang login`

On a computer that has never signed in, or after jiayang logout, they fail with:

error: not logged in: run `jiayang login`
Terminal window
jiayang logout
Signed out.

This ends the session on the platform and removes the token from this computer. If the platform can’t be reached, the CLI still forgets the token and warns you that the session keeps working until it expires or you revoke it. With no session here, it says You weren't signed in.

In the dashboard, open the account menu and choose Sessions. The page lists every browser and every CLI session you have, with where each one signed in and when it was last used. A CLI session is named after the computer it signed in from, like “jiayang CLI on ada-laptop”.

  • Revoke ends one session. It stops working on its next request, and a revoked browser is signed out of every app within a minute.
  • Sign out everywhere ends every browser and CLI session you have, including the one you’re using.

Revoke a CLI session when you lose a laptop or stop using a machine.

The CLI keeps your session in config.json in its config directory:

System Directory
macOS and Linux ~/.config/jiayang, or $XDG_CONFIG_HOME/jiayang when that’s set
Windows %APPDATA%\jiayang

Set JIAYANG_CONFIG_DIR to use another directory, or pass --config-dir to one command. With a second directory you can stay signed in as two people at once.

The file holds the API address, your email, the session token and when it ends. On macOS and Linux only your user can read it. Treat it like a password: anyone who copies it can act as you until the session ends or you revoke it.

An agent that uses jiayang mcp acts as whoever the CLI is signed in as, with your permissions and your name in the audit log. See Use with Claude Code, Codex and Cursor.

For a CI job or a script that calls your app, create a bypass token for the app instead of copying your session. See Tokens for scripts and machines.

jiayang login --dev you@example.com signs in as that email to a copy of the platform running on your own machine, which is for working on the platform itself. To run your app locally behind the platform’s sign-in, use jiayang dev, described in Local development.