Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

autotune does not use api-secret when needed #397

Closed
beached opened this issue Feb 11, 2017 · 5 comments

Comments

Projects
None yet
6 participants
@beached
Copy link
Contributor

commented Feb 11, 2017

I have a nightscout setup that is in default deny mode and needs an api-secret to view data. I cannot see how or any references to it in the autotune code when calling curl to retrieve data. I am not sure the approach, but seems this may be tangentially related to #299

@scottleibrand scottleibrand changed the title autotune does use api-secret autotune does not use api-secret when needed Feb 11, 2017

@gregtcm

This comment has been minimized.

Copy link

commented Feb 16, 2017

This showed up for me with this error:

src/oref0/lib/autotune-prep/categorize.js:21
        var glucoseData = opts.glucose.map(function prepGlucose (obj) {
                                       ^

TypeError: opts.glucose.map is not a function
    at categorizeBGDatums (/home/gnu/src/oref0/lib/autotune-prep/categorize.js:21:40)
@PieterGit

This comment has been minimized.

Copy link
Contributor

commented Jul 23, 2017

This is fixed with #563
Autotune now accepts:

  • no authentication (readable Nightscout)
  • hashed API_SECRET. API_SECRET must be set as environment variable to the autotune script.
  • token based authentication, API_SECRET starts with token=hash
@lgruen

This comment has been minimized.

Copy link

commented Feb 25, 2018

Maybe my version of curl (7.54.0) on Mac OS is weird, but I had to change the ns-get script from
CURL_AUTH='-H "api-secret: ${API_SECRET}"'
to
CURL_AUTH="-H api-secret:${API_SECRET}"
for this to work. As mentioned in the previous comment, API_SECRET needs to be set to the hashed API_SECRET, which can be generated using
nightscout hash-api-secret $UNHASHED_API_SECRET

@mountrcg

This comment has been minimized.

Copy link

commented Oct 5, 2018

In oref0-autotune.sh I have tried to set environment variable API_SECRET using the hash or the token:

API_SECRET=32ea1df04----------------e84f2750
API_SECRET=token=autotune-5f--------a8

both don't work on a Nightscout site with AUTH_DEFAULT_ROLES set to denied. Any ideas how to get it to work on a Mac?

@mountrcg

This comment has been minimized.

Copy link

commented Oct 5, 2018

found solution. had to specify it in osx environment variables
export API_SECRET=token=autotune-5f--------a8

viq added a commit to viq/docs that referenced this issue Oct 6, 2018

Mention proper formats for API_SECRET
Turns out, as mentioned in openaps/oref0#397, `API_SECRET` can have two formats - either `API_SECRET=string_you_gave_to_nightscout` or `API_SECRET=token=token_you_generated_in_nightscout_admin_interface`. Mention this so people don't need to enter the error into search engine to know what's going on.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.