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
- The CLI shows a code and opens the admin of the site in your browser.
- Sign in there if you are not, and approve the code.
- 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.
TENON_URL, else it asks. Only the origin counts, so https://example.com/admin signs in to https://example.com.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_HOMEwhen 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 loginagain after it.
When it fails
| Message | Why |
|---|---|
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 login | The 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.
Related resources
- Overview: local or remote, and CI.
- API keys: access for scripts, without a browser.
- Authentication: sessions and sign-in methods.