DeesseJS

Authentication

Sign in with the CLI.

You can run public registry commands (list, info, and init) and block inspection commands without signing in. Use auth login to start a device-flow session for this machine. auth status checks the session, and auth logout clears it.

The CLI uses OAuth 2.0 device authorization grant for sign-in. You never enter a password, copy an API token, or open a headless browser.

deessejs auth login

deessejs auth login

What happens:

  1. The CLI requests a device code from POST /api/v1/auth/device/code on the DeesseJS server. The response carries a short user code and a long device code, plus a verification URL.
  2. The CLI spawns your default browser at the verification URL: https://app.deessejs.com/device?user_code=....
  3. The CLI polls POST /api/v1/auth/device/token until you approve (or deny) in the browser.
  4. On approval, the CLI exchanges the device code for an access token, validates it server-side, and writes ~/.deessejs/auth.json with mode 0600.
  5. The CLI echoes the identity you signed in with. The access token itself never prints.

If you haven't signed in to app.deessejs.com, the /device page sends you through the normal login flow. After you sign in, the browser returns to /device?redirect=....

Flags

FlagEffect
--jsonMachine-readable output ({ ok: true, user } on success, { ok: false, code, message } for a handled CLI error).

Exit codes

  • 0: successful login.
  • 1: any failure. Device-flow denials return cli_device_denied. Expired or unusable device flows return cli_device_expired. The general error handler reports unexpected failures.

deessejs auth status

deessejs auth status

The command reads the cached session and checks it with GET /api/v1/auth/get-session, using a Bearer header. It reports one of three terminal states:

StateOutputExit code
No ~/.deessejs/auth.jsonNo active session. Run deessejs auth login to sign in.0
Token still validActive-session message, identity, and fetchedAt timestamp0
Token revoked or expired server-sideStale-session notice and the stored identity for context0

All three normal states exit 0. The command only reads the stored file. A failed server request returns exit code 1.

The token never echoes, only its fetchedAt timestamp and the resolved user identity (email, name, id).

Flags

FlagEffect
--jsonEmits { ok: true, user, fetchedAt }, { ok: false, reason: "no_session" }, or { ok: false, reason: "session_invalid", stored: { user, fetchedAt } }.

deessejs auth logout

deessejs auth logout

Two-step teardown:

  1. Send POST /api/v1/auth/sign-out with the stored bearer token to invalidate the session on the server.
  2. Delete ~/.deessejs/auth.json regardless of the sign-out outcome. A stale file would make every later command use an invalid token, so remove it even if sign-out fails.

If ~/.deessejs/auth.json doesn't exist, auth logout exits 0 silently: there's no session to revoke. A network failure while signing out still deletes the local file, then exits with an error.

Flags

FlagEffect
--json{ ok: true } on success, { ok: true, reason: "no_session" } if nothing existed to revoke.

Where the token lives

The CLI stores the token in ~/.deessejs/auth.json. On systems that follow the Portable Operating System Interface (POSIX), the CLI writes the file with owner-only permissions (0600). auth status reports whether the server accepts the token. A stale token stays in the file until you run auth login again or auth logout.

The file shape:

{
  "access_token": "...",
  "user": { "id": "...", "email": "...", "name": "..." },
  "fetchedAt": "2026-09-21T10:00:00.000Z"
}

Treat the token as opaque. Keep the entire file secret.

Organization selection

The CLI uses its bearer token to read memberships and the active organization from its Better Auth session. Run deessejs organization use <slug> to select an organization, then run deessejs organization current or deessejs organization list to check the CLI selection. The CLI doesn't store a separate active organization in auth.json. Its device-flow token identifies its own session, so a selection made in a separate browser session might not appear in the CLI.

organization current reports an active organization, an unset selection, or a stale selection that no longer matches a membership. A stale selection points to an organization outside your memberships. Read commands leave it unchanged. To choose another organization, run deessejs organization use <slug> with a slug from deessejs organization list.

Troubleshooting

"The stored token no longer matches an active session on the server."

Run deessejs auth login again. The CLI cached a token that the server no longer recognises (you signed out elsewhere, the session got revoked, or the access token expired). auth status keeps echoing the stale identity until you re-login.

cli_device_denied

You selected Deny on the /device page, or the page expired before you approved. Run deessejs auth login again.

cli_device_expired

The 30-minute device-code window elapsed before you approved. The CLI stops polling and exits. Run deessejs auth login again to request a fresh code.

Permission errors writing ~/.deessejs/auth.json

On systems that follow the Portable Operating System Interface (POSIX), the CLI sets the auth file to owner-only permissions when it writes it. If your user can't write to ~/.deessejs/, update the directory permissions, then run deessejs auth login again.

"Logged in as unknown user"

The CLI never falls back to a synthetic identity when the server rejects the bearer token. If you see this, it means auth.json got hand-edited or copied from another machine. Delete the file and re-login.

Network errors during polling

The device code expires after 30 minutes. If a network failure interrupts polling, restore connectivity and run deessejs auth login again to request a fresh code.

On this page