Skip to main content

Login

The CLI uses browser-based OAuth login by default, making authentication quick and easy.

Basic login

where {{ lightdash_domain }} is the subdomain for your Lightdash instance. For example, if you login at https://petey.lightdash.cloud, then you would type lightdash login petey to pop up a login window.
This opens your browser to authenticate. Once authorized, youโ€™re logged in and ready to use the CLI.

Flexible URL formats

The CLI accepts your instance URL in multiple formats, all of these work:
For Lightdash Cloud users, you can simply use your subdomain (e.g., petey if your instance is at petey.lightdash.cloud). For self-hosted instances, you can use the full domain without the https:// prefix - itโ€™s assumed automatically.

Re-authenticate to a previous instance

Once youโ€™ve logged in, you can re-authenticate without specifying the URL:
This uses your previously saved instance URL.
If you use single sign-on (SSO) in the browser, login with a personal access token.First, create a new personal access token in the UI by going to Settings > Personal Access Tokens.
Then, run the following command:
You can use the following environment variables to authenticate yourself on each command:
  • LIGHTDASH_API_KEY a personal access token you can generate in the app under the user settings
  • LIGHTDASH_URL address for your running Lightdash instance
  • LIGHTDASH_PROXY_AUTHORIZATION if your Lightdash instance is behind a proxy like Cloud IAP you can set here Proxy-Authentication header value
Example:

Set active project

When you login youโ€™ll be asked to set an active project. Your active project is just the one that youโ€™re working on/developing in. Your organization might just have one project, so that makes your decision easy! You can change your active project by running:
Or you can use the LIGHTDASH_PROJECT environment variable to indicate what project UUID the command should use. Example:

Now that youโ€™ve logged in, youโ€™re ready to use the CLI

You can see all of the actions available on the CLI by typing this in your terminal:
Some of our favourites are: