Skip to content

Commit

Permalink
Make api token gen cleaner
Browse files Browse the repository at this point in the history
  • Loading branch information
jooola committed Jun 7, 2019
1 parent 50e304d commit 4b44c90
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ openssl rand -hex 10
head /dev/urandom | tr -dc A-Za-z0-9 | head -c 10 ; echo
```

The token is generated using the md5sum of your password concatenated to the previous salt string (`token = md5(password + salt)`). Use the following command to generate the token:
The token is generated using the md5sum of your password concatenated to the previous salt string `token = md5(password + salt)`. Use the following command to generate the token:
```sh
echo -n <password><salt> | md5sum
echo -n <password><salt> | md5sum | awk '{ print $1 }')
```

> **NOTE**: The awk command is using to remove the md5 source name from the output, in our case from stdin `-`.
You can now pass your username, the token and salt to your api requests:
```sh
curl 'http://your-server/rest/ping.view?u=<username>&t=<token>&s=<salt>&v=1.15.0&c=<your-app>'
Expand All @@ -54,5 +56,3 @@ echo ${SALT}
echo ${TOKEN}
curl "${SERVER}/rest/ping.view?u=${USERNAME}&t=${TOKEN}&s=${SALT}&v=1.15.0&c=${CLIENT}"
```

> **NOTE**: The awk command is using to remove the md5 source name from the output, in our case from stdin `-`.

0 comments on commit 4b44c90

Please sign in to comment.