Skip to content

CLI: Login and access tokens

Commands to log in to and out of Hako CMS, switch the connection target, and list and revoke access tokens. Common flags that you can add to any command (--host, --json, and others) are in the CLI command reference.

For how to use them, see Log in with the CLI.

Command Description
hakocms-cli auth login Log in to a server and save an access token
hakocms-cli auth logout Log out and revoke the saved access token
hakocms-cli auth status Show the connection targets you are logged in to, and which one is currently selected
hakocms-cli auth switch Change the connection target used when you omit –host
hakocms-cli auth token Print the connection target’s access token (to pass to other tools)
hakocms-cli auth tokens list List your access tokens
hakocms-cli auth tokens revoke Revoke one of your access tokens

Log in to a server and save an access token.

Opens the admin in a browser; confirm that it shows the same characters as the terminal, and allow access. To use a token you created in the admin, pass it on standard input with –with-token. Tokens are stored per connection target in the OS credential store (hosts.toml if that is not available)

ターミナルウィンドウ
hakocms-cli auth login [OPTIONS]
Flag or argument Description
--name <NAME> A name for the connection target (use it like –host staging). If omitted, the hostname
--with-token Read the token from standard input (hakocms-cli auth login –host … –with-token < token.txt)
--no-browser Do not open a browser; print only the URL

Log out and revoke the saved access token.

ターミナルウィンドウ
hakocms-cli auth logout

Show the connection targets you are logged in to, and which one is currently selected.

ターミナルウィンドウ
hakocms-cli auth status

Change the connection target used when you omit –host.

ターミナルウィンドウ
hakocms-cli auth switch <NAME>
Flag or argument Description
<NAME> The name you gave with auth login

Print the connection target’s access token (to pass to other tools)

ターミナルウィンドウ
hakocms-cli auth token

List your access tokens.

ターミナルウィンドウ
hakocms-cli auth tokens list

Revoke one of your access tokens.

ターミナルウィンドウ
hakocms-cli auth tokens revoke [OPTIONS] <ID>
Flag or argument Description
<ID> ID
--force Do it without asking for confirmation