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.
Sign in with your browser
Section titled “Sign in with your browser”sharek auth:loginThe 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.
Where the credentials live
Section titled “Where the credentials live”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.
Sign in with an API key instead
Section titled “Sign in with an API key instead”For CI, a server, or a container with no browser:
export SHAREK_API_KEY=your-api-keyTake 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:
export SHAREK_API_URL=https://dash.sharek.app/apiThe 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.
Check where you stand
Section titled “Check where you stand”sharek auth:statusIt 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.
Sign out
Section titled “Sign out”sharek auth:logoutRemoves ~/.sharek/credentials.json. If SHAREK_API_KEY is set in your environment, the
CLI falls back to it from the next command onwards.
When it will not sign in
Section titled “When it will not sign in”- “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 iscurl https://cli-auth.sharek.app/health, which answers{"status":"ok"}. - The code expires while you are away. Run
sharek auth:loginagain 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 runsharek auth:loginagain; withSHAREK_API_KEY, the key was rotated, so set the new one. The same message also shows when your plan does not include the API.
Where to go next
Section titled “Where to go next”- 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.