CLI

tenon login

Sign the CLI in to a deployed site, and out again.

tenon login signs the CLI in to a running site, so backup, restore and users create work there with --url. tenon logout signs it out again. A local project needs no sign-in.

tenon login

npx tenon login https://example.com
  1. The CLI shows a code and opens the admin of the site in your browser.
  2. Sign in there if you are not, and approve the code.
  3. The CLI stores the session and prints the email of the user who approved it.

The session has the rights of that user. users create --url needs an admin.

The site. Without it, the CLI takes TENON_URL, else it asks. Only the origin counts, so https://example.com/admin signs in to https://example.com.Prints the link instead of opening the browser. Use it on a server without a browser, and open the link on another device.

The session

  • It lasts like a session in the admin: 7 days, renewed on use.
  • It is stored per site in ~/.config/tenon/credentials.json, or under $XDG_CONFIG_HOME when it is set. Only your user can read the file.
  • The CLI sends it to that site only.
  • A remote restore of a full backup signs everyone out, the CLI included. Run tenon login again after it.

When it fails

MessageWhy
The code expired. Run tenon login again.Nobody approved the code in time.
The sign-in was denied.The code was denied in the admin.
<url> has no device loginThe site sets admin: false, so it has no page to approve the code. Use an API key.

tenon logout

npx tenon logout https://example.com

It ends the session on the site and removes it from the credentials file. Without a URL, it takes TENON_URL.