Skip to content

Sign in

The CLI has two ways in. The browser flow is the one to use: nothing to copy, nothing to paste, and the credentials land on disk with the right permissions. An API key in your environment is there for servers and CI, where no browser exists.

Every command fails without one of them.

Terminal window
sharek auth:login

The CLI asks https://cli-auth.sharek.app for a code, prints it in a box, and opens your browser at the sign-in server’s page with the code already filled in:

🔐 Starting device authorization flow...
Your authorization code:
┌─────────────────┐
│ ABCD-EFGH │
└─────────────────┘
Open this URL and enter the code above:
https://cli-auth.sharek.app/device/verify
Waiting for authorization...

Press Authorize on that page, then Authorize again on the Sharek screen it takes you to, signing in first if Sharek asks. The terminal checks every five seconds, so it picks the approval up almost immediately and stores the credentials.

If the browser does not open on its own, the URL is printed right there. Open it and type the code. Codes last 15 minutes, so if you leave one sitting, run the command again for a fresh one.

In ~/.sharek/credentials.json, written readable only by you. That file holds the token the CLI sends on every call, so treat it the way you would an SSH key. Copying it to another machine works, and so does anyone else who gets hold of it.

For CI, a server, or a container with no browser:

Terminal window
export SHAREK_API_KEY=your-api-key

Take the key from Settings, then Developers, then the API Key card in Sharek. API authentication walks through that screen.

Not on every plan. The Developers tab appears only when your plan includes the public API, and the CLI works only on such a plan, whichever way you sign in. See pricing.

To point the CLI at a different base address, which you should not normally need:

Terminal window
export SHAREK_API_URL=https://dash.sharek.app/api

The sign-in server can be changed the same way, with SHAREK_AUTH_SERVER or sharek auth:login --auth-server <url>. The flag wins if you set both.

Terminal window
sharek auth:status

It reports which method is in use and shows the first few characters of the token or key. After a browser sign-in it also names the credentials file. It then calls the API to confirm the credentials still work and tells you how many channels are connected. An expired or revoked credential is reported as such rather than failing at the next command.

Terminal window
sharek auth:logout

Removes ~/.sharek/credentials.json. If SHAREK_API_KEY is set in your environment, the CLI falls back to it from the next command onwards.

  • “Could not reach auth server” means the CLI could not get to https://cli-auth.sharek.app. Check the network and any proxy. A quick test is curl https://cli-auth.sharek.app/health, which answers {"status":"ok"}.
  • The code expires while you are away. Run sharek auth:login again for a fresh one.
  • Commands fail straight after signing in. Run sharek auth:status. If it says the credentials are expired or invalid: after a browser sign-in, the CLI’s access was revoked under Settings → Apps → Approved Apps, so run sharek auth:login again; with SHAREK_API_KEY, the key was rotated, so set the new one. The same message also shows when your plan does not include the API.
  • Command reference now that you are signed in.
  • Revoking a credential if you think one is out: rotate the API key for SHAREK_API_KEY, and revoke the CLI under Settings → Apps → Approved Apps for a browser sign-in.