You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-5Lines changed: 31 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,8 @@ The binary from `go install` is named `glassnode-cli`. To get the same `gn` comm
43
43
## Quick Start
44
44
45
45
```bash
46
-
#Set your API key
47
-
export GLASSNODE_API_KEY=your-key
46
+
#Sign in with your Glassnode account
47
+
gn login
48
48
49
49
# List available assets
50
50
gn asset list
@@ -53,15 +53,39 @@ gn asset list
53
53
gn metric get market/price_usd_close --asset BTC --since 30d
54
54
```
55
55
56
+
Or authenticate with an API key instead:
57
+
58
+
```bash
59
+
export GLASSNODE_API_KEY=your-key
60
+
```
61
+
56
62
## Authentication
57
63
64
+
### OAuth
65
+
66
+
Sign in with your Glassnode account:
67
+
68
+
```bash
69
+
gn login
70
+
```
71
+
72
+
And to sign out:
73
+
74
+
```bash
75
+
gn logout
76
+
```
77
+
78
+
### API key
79
+
58
80
The CLI resolves the API key in the following priority order:
59
81
60
82
1.`--api-key` flag (highest priority)
61
83
2.`GLASSNODE_API_KEY` environment variable
62
84
3.`~/.gn/config.yaml` configuration file
63
85
64
-
To persist the key in the config file:
86
+
However the OAuth access token has precedence and will be used if it is available.
87
+
88
+
To persist the API key in the config file:
65
89
66
90
```bash
67
91
gn config set api-key=your-key
@@ -193,13 +217,15 @@ gn config set output=csv
193
217
194
218
### `gn config get <key|all>`
195
219
196
-
Read a configuration value, or all values.
220
+
Read a configuration value, or all values. Sensitive values (`api-key`, `oauth-access-token`, `oauth-refresh-token`) are **masked** as `*****-<last4>` so they're safe to show in screen shares, recordings, or shell scrollback.
197
221
198
222
```bash
199
-
gn config get api-key
223
+
gn config get api-key# e.g. "*****-cdef"
200
224
gn config get all
201
225
```
202
226
227
+
OAuth session fields (`oauth-access-token`, `oauth-refresh-token`, `oauth-expires-at`) are read-only: they are written only by `gn login` / token refresh and cannot be changed via `gn config set`.
0 commit comments