Skip to content

Commit 8a9b586

Browse files
Update README.md
1 parent 467400a commit 8a9b586

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

README.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ This example shows how to use the Splunk Enterprise SDK for JavaScript and Node.
110110
});
111111
```
112112
##### Login with sessionKey
113+
113114
```shell
114115
# Create a sessionKey
115116
curl -k -u <username>:<password> <scheme>://<host>:<port>/services/auth/login -d username=<username> -d password=<password>
@@ -122,7 +123,7 @@ var serviceWithSessionKey = new splunkjs.Service(
122123
scheme: 'https',
123124
host: 'localhost',
124125
port: '8089',
125-
sessionKey: 'SESSION_KEY', // Add your session key
126+
sessionKey: SESSION_KEY, // Add your sessionKey here
126127
version: '8',
127128
});
128129

@@ -138,17 +139,20 @@ serviceWithSessionKey.get("search/jobs", { count: 1 }, function (err, res) {
138139
##### Login with token
139140

140141
```shell
141-
# Enable token authetication from shell
142+
#### From shell ####
143+
# Enable token authetication
142144
curl -k -u <username>:<password> -X POST <scheme>://<host>:<port>/services/admin/token-auth/tokens_auth -d disabled=false
143145

144-
# Enable token authentication from web
145-
Go to settings > Tokens and click on 'Enable Token Authentication'
146+
# Create a token
147+
curl -k -u <username>:<password> -X POST <scheme>://<host>:<port>/services/authorization/tokens?output_mode=json --data name=admin --data audience=Users --data-urlencode expires_on=+30d
146148
```
149+
147150
```shell
148-
# Create a token from shell
149-
curl -k -u <username>:<password> -X POST <scheme>://<host>:<port>/services/authorization/tokens?output_mode=json --data name=admin --data audience=Users --data-urlencode expires_on=+30d
151+
#### From web ####
152+
# Enable token authentication
153+
Go to settings > Tokens and click on 'Enable Token Authentication'
150154

151-
# Create a token from web
155+
# Create a token
152156
1. Go to settings > Token and click on 'New Token'
153157
2. Enter the relevant information
154158
3. Copy the created token and save it somewhere safe.
@@ -161,7 +165,7 @@ var serviceWithBearerToken = new splunkjs.Service(
161165
scheme: 'https',
162166
host: 'localhost',
163167
port: '8089',
164-
sessionKey: 'TOKEN', // Add your token here
168+
sessionKey: TOKEN, // Add your token here
165169
version: '8',
166170
});
167171

0 commit comments

Comments
 (0)