Skip to content

Commit

Permalink
Merge pull request #139 from outlyer-net/pr/api-token-doc-update
Browse files Browse the repository at this point in the history
API token handling clarification
  • Loading branch information
timoschlueter authored May 27, 2024
2 parents 58b3978 + 94b2585 commit 441664f
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ There are different options for using this script.
- Click on [![Deploy](https://www.herokucdn.com/deploy/button.svg)][heroku]
- Login to Heroku if not already happened
- Provide proper values for the `environment variables`
- **Important: make sure that yor Nightscout API token is hashed with SHA1**
- **Important: make sure that yor Nightscout API token is [hashed with SHA1](#hashing-api-token)**
- Click `Deploy` to deploy the app

### Variant 2: Local
Expand Down Expand Up @@ -69,7 +69,7 @@ docker run -e LINK_UP_USERNAME="[email protected]" \
-e LINK_UP_TIME_INTERVAL="5" \
-e LINK_UP_REGION="EU" \
-e NIGHTSCOUT_URL="nightscout.yourdomain.com" \
-e NIGHTSCOUT_API_TOKEN="librelinku-123456789abcde" \
-e NIGHTSCOUT_API_TOKEN=$(echo -n "foo-bar-baz" | sha1sum | cut -d ' ' -f 1) \
-e LOG_LEVEL="info" \
timoschlueter/nightscout-librelink-up
```
Expand All @@ -92,10 +92,28 @@ services:
LINK_UP_TIME_INTERVAL: "5"
LINK_UP_REGION: "DE"
NIGHTSCOUT_URL: "nightscout.yourdomain.com"
NIGHTSCOUT_API_TOKEN: "librelinku-123456789abcde"
NIGHTSCOUT_API_TOKEN: "14c779d01a34ad1337ab59c2168e31b141eb2de6"
LOG_LEVEL: "info"
```
### Hashing API token
`NIGHTSCOUT_API_TOKEN` must be a SHA1 hash of an Access Token from Nightscout (_Add new subject_ first in Nightscout's _Admin Tools_ if required), e.g. your Access Token for a subject named _LibreLinkUp_ might be `librelinku-123456789abcde`.

Obtain your hash with

```shell
echo -n "librelinku-123456789abcde" | sha1sum | cut -d ' ' -f 1
```
(use `shasum` instead of `sha1sum` on Mac)

which will print the hash (40 characters in length):
```
14c779d01a34ad1337ab59c2168e31b141eb2de6
```

You might also use an online tool to generate your hash, e.g. https://codebeautify.org/sha1-hash-generator

## ToDo

- **Integration into Nightscout**: I have not yet looked into the plugin architecture of Nightscout. Maybe this should
Expand Down

0 comments on commit 441664f

Please sign in to comment.