Skip to content

Authorization ​

Before the CLI can preview or publish dashboards, it needs a token that signs it in to Diver as you. Run diver login once on each computer you use the CLI on.

Log in ​

bash
diver login

The CLI then:

  1. Creates a one-time authorization code, five words joined by underscores such as these_are_five_example_words.
  2. Copies the code to your clipboard and prints it in the terminal.
  3. Opens the Diver authorization page in your browser.
text
Complete authorization at https://dashboards.withdiver.com/auth/cli
Your auth code is:
these_are_five_example_words

Waiting...

In the browser, sign in to Diver if you aren't already, then:

  1. Paste the code into Authorization code and select Authorize.
  2. Choose the Workspace the CLI starts working in.
  3. Check the Name. It defaults to your computer's name and is how the token appears in Diver later.
  4. Select Authorize again.

The terminal prints Successfully logged in! and saves the token. Any later diver command uses it automatically.

TIP

You have 50 seconds to finish in the browser. If the terminal gives up with "Login timed out before authorization completed", run diver login again to get a new code.

Log in without opening a browser ​

On a server, in a container, or anywhere a browser can't open, add --no-open:

bash
diver login --no-open

The CLI prints the authorization page's address and the code instead of opening the browser. Open the address on any device where you can sign in to Diver, and enter the code there. If the clipboard isn't available, the CLI prints a warning and you copy the code from the terminal instead.

Where the token is stored ​

The token and the workspace the CLI works in are saved in ~/.diver/config:

yaml
auth:
  token: <your token>
workspace_id: <your workspace id>

Treat this file like a password: anyone who has the token can publish dashboards to every workspace you're a member of.

Switch workspace ​

The token works in every workspace you're a member of. To work in another one, run:

bash
diver setup

Pick the workspace from the list with the arrow keys and press Enter. The workspace you use now is marked (current). If you're a member of only one workspace, the CLI selects it for you. Your token stays the same, so you don't need to log in again.

Revoke a token ​

Every authorized computer is listed in Diver under Connections → Command Line in the workspace you chose when you authorized it, by the name you gave it. Delete a token there to stop that computer from using it, for example when you replace a laptop. Run diver login to authorize again.

Reach new depths