Skip to content

Commit dfd8e82

Browse files
owlasmintlify[bot]jpetey75
authored
Update CLI login documentation with improved authentication flow (#282)
* Update guides/cli/cli-authentication.mdx Co-Authored-By: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> * clean up AI changes * fix image ref --------- Co-authored-by: mintlify[bot] <109931778+mintlify[bot]@users.noreply.github.com> Co-authored-by: Jake Peterson <5532776+jpetey75@users.noreply.github.com>
1 parent 6e78556 commit dfd8e82

File tree

1 file changed

+64
-31
lines changed

1 file changed

+64
-31
lines changed

guides/cli/cli-authentication.mdx

Lines changed: 64 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,56 +6,91 @@ icon: "key"
66

77
## Login
88

9-
<AccordionGroup>
10-
<Accordion title="1. You can login on the CLI from your browser using OAuth2.">
11-
To log in to your Lightdash instance using OAuth2, run the following command:
9+
The CLI uses browser-based OAuth login by default, making authentication quick and easy.
1210

13-
```bash
14-
lightdash login https://{{ lightdash_domain }} --oauth
15-
```
11+
### Basic login
1612

17-
where `{{ lightdash_domain }}` is the address for your running Lightdash instance. For example Lightdash cloud users in the US would type `lightdash login https://app.lightdash.cloud` if you're in Europe you'd type`lightdash login https://eu1.lightdash.cloud`.
1813

19-
This will open a new tab in your default browser. Log in to your Lightdash account (if you're not already logged in), then authorize the lightdash-cli client.
2014

21-
Once authorized, you’ll be logged in and ready to use the CLI.
15+
```bash
16+
lightdash login {{ lightdash_domain }}
17+
```
2218

23-
<Frame>
24-
<img src="images/oauth-authorize.png" alt="" />
25-
</Frame>
19+
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.
2620

27-
28-
</Accordion>
29-
30-
<Accordion title="2. If you use your email + password in the browser, login with your email and password.">
31-
To login to your Lightdash instance run the following command and provide your login email and password:
21+
22+
```bash
23+
lightdash login petey
24+
```
25+
26+
This opens your browser to authenticate. Once authorized, you're logged in and ready to use the CLI.
27+
28+
<Frame>
29+
<img src="/images/oauth-authorize.png" alt="" />
30+
</Frame>
31+
32+
33+
### Flexible URL formats
34+
35+
The CLI accepts your instance URL in multiple formats, all of these work:
36+
37+
```bash
38+
# Just your subdomain (recommended for Lightdash Cloud)
39+
lightdash login your_subdomain_here
40+
41+
# Full domain without protocol
42+
lightdash login your_subdomain_here.lightdash.cloud
43+
44+
# Full URL with protocol
45+
lightdash login https://your_subdomain_here.lightdash.cloud
46+
47+
# Any URL from your Lightdash instance (useful for copying from browser)
48+
lightdash login https://your_subdomain_here.lightdash.cloud/projects/abc123/dashboards
49+
```
50+
51+
For Lightdash Cloud users, you can simply use your subdomain (e.g., `petey` if your instance is at `petey.lightdash.cloud`).
52+
53+
For self-hosted instances, you can use the full domain without the `https://` prefix - it's assumed automatically.
54+
55+
56+
### Re-authenticate to a previous instance
57+
58+
Once you've logged in, you can re-authenticate without specifying the URL:
59+
60+
```bash
61+
lightdash login
62+
```
63+
64+
This uses your previously saved instance URL.
65+
66+
<AccordionGroup>
67+
<Accordion title="Login with email and password">
68+
If you prefer to use email and password instead of browser-based OAuth:
3269

3370
```bash
34-
lightdash login https://{{ lightdash_domain }}
71+
lightdash login your_subdomain_here --no-oauth
3572
```
3673

37-
where `{{ lightdash_domain }}` is the address for your running Lightdash instance. For example Lightdash cloud users in the US would type `lightdash login https://app.lightdash.cloud` if you're in Europe you'd type`lightdash login https://eu1.lightdash.cloud`.
74+
You'll be prompted to enter your email and password.
3875
</Accordion>
3976

40-
<Accordion title="3. If you use single sign-on (SSO) in the browser, login with a personal access token.">
41-
First, you'll need to create a new personal access token in the UI by going to Settings > Personal Access Tokens. You can't use an existing personal access token! You have to create a new one just for yourself.
77+
<Accordion title="Login with a personal access token (for SSO users)">
78+
If you use single sign-on (SSO) in the browser, login with a personal access token.
4279

43-
{' '}
80+
First, create a new personal access token in the UI by going to Settings > Personal Access Tokens.
4481

4582
<Frame>
4683
<img src="/images/guides/cli/personal-access-token-9ed8a8c2b16edc5ee745c4909d4093d3.png" alt="" />
4784
</Frame>
4885

49-
Then, run the following command in your project:
86+
Then, run the following command:
5087

5188
```bash
52-
lightdash login https://{{ lightdash_domain }} --token
89+
lightdash login your_subdomain_here --token
5390
```
54-
55-
where `https://my-lightdash.domain.com` is the address for your running Lightdash instance. For example Lightdash cloud users in the US would type `lightdash login https://app.lightdash.cloud` if you're in Europe you'd type`lightdash login https://eu1.lightdash.cloud`.
5691
</Accordion>
5792

58-
<Accordion title="4. If you're running in a CI/CD pipeline, login with environment variables">
93+
<Accordion title="Login with environment variables (for CI/CD)">
5994
You can use the following environment variables to authenticate yourself on each command:
6095

6196
* **LIGHTDASH\_API\_KEY** a personal access token you can generate in the app under the user settings
@@ -67,10 +102,8 @@ Once authorized, you’ll be logged in and ready to use the CLI.
67102
Example:
68103

69104
```bash
70-
LIGHTDASH_API_KEY=946fedb74003405646867dcacf1ad345 LIGHTDASH_URL="https://{{ lightdash_domain }}" LIGHTDASH_PROXY_AUTHORIZATION="Bearer <JWT_TOKEN>" lightdash preview
105+
LIGHTDASH_API_KEY=946fedb74003405646867dcacf1ad345 LIGHTDASH_URL="https://your_subdomain_here.lightdash.cloud" LIGHTDASH_PROXY_AUTHORIZATION="Bearer <JWT_TOKEN>" lightdash preview
71106
```
72-
73-
Where `{{ lightdash_domain }}` is your domain. For Lightdash Cloud users use `https://app.lightdash.cloud`
74107
</Accordion>
75108
</AccordionGroup>
76109

@@ -108,4 +141,4 @@ Some of our favourites are:
108141

109142
* [Testing your changes with developer previews using lightdash preview](/guides/cli/how-to-use-lightdash-preview)
110143

111-
* [Deploying your changes to production using lightdash deploy](/guides/cli/how-to-use-lightdash-deploy)
144+
* [Deploying your changes to production using lightdash deploy](/guides/cli/how-to-use-lightdash-deploy)

0 commit comments

Comments
 (0)