-
Notifications
You must be signed in to change notification settings - Fork 232
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
Rest API giving Authorisation error #111
Comments
I'm not sure this is covered by this documentation, did you ask in Discord? https://github.com/nightscout/cgm-remote-monitor/issues/new/choose |
Howdy @dcallagh. I think you would benefit from looking at cat <<EOT | json | curl --data-binary @- -H "Content-Type: application/json" -H "API_SECRET: $hashed_secret" https:///api/1/treatments.json
[{"eventType":"","created_at":"2021-04-10T15:28:00Z","carbs":27,"insulin":3.9}]"
EOT Note that the api secret has been hashed using something like |
Hi Ben,
Result from using your suggested curl command slightly amended to include Json embedded, but still with the upper case API_SECRET gave the same error: {"status":401,"message":"Unauthorized","description":"Invalid/Missing"} |
I must say that this did not seem to work with latest version, but in any case if someone gets into here: This works, with the new security model where the token has write permissions. |
@dcallagh, |
Yes, I cannot recall the solution though as weve moved to tsl8m. Think it was the url path being invalidSent from my Galaxy
-------- Original message --------From: dinizmauricio ***@***.***> Date: 16/10/23 3:19 am (GMT+10:00) To: "nightscout/nightscout.github.io" ***@***.***> Cc: dcallagh ***@***.***>, Mention ***@***.***> Subject: Re: [nightscout/nightscout.github.io] Rest API giving Authorisation error (#111)
@dcallagh,
Did you manage to resolve the problem? I'm going through the same situation.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
I'll see if I can hunt up the Python Sent from my Galaxy
-------- Original message --------From: dinizmauricio ***@***.***> Date: 16/10/23 3:19 am (GMT+10:00) To: "nightscout/nightscout.github.io" ***@***.***> Cc: dcallagh ***@***.***>, Mention ***@***.***> Subject: Re: [nightscout/nightscout.github.io] Rest API giving Authorisation error (#111)
@dcallagh,
Did you manage to resolve the problem? I'm going through the same situation.
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@dcallagh, I tried with the code below, but it's not working. :/ ############# print(resposta.status_code) print (resposta.text) |
Here's one version I found.#REST UPLOADurl = "https://mynightscout.herokuapp.com/api/v1/treatments"str="mysecret"sha1=hashlib.sha1(str.encode())headers = {"api-secret":sha1.hexdigest()}Sent from my Galaxy
-------- Original message --------From: dinizmauricio ***@***.***> Date: 16/10/23 8:15 am (GMT+10:00) To: "nightscout/nightscout.github.io" ***@***.***> Cc: dcallagh ***@***.***>, Mention ***@***.***> Subject: Re: [nightscout/nightscout.github.io] Rest API giving Authorisation error (#111)
@dcallagh, I tried with the code below, but it's not working. :/
#############
myHash='d018020ba8f49a010afdbabf7e8be89441085750'
header1 = {'api-secret': myHash}
data = {
"carbs": 10
}
resposta = requests.post('http://192.168.0.1:17580/entries', headers=header1, json=data)
print(resposta.status_code)
print (resposta.text)
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Hi Gurus,
am extracting treatment logs from Accuchek SOLO for upload. testing the rest API for treatments at https:///api-docs/#/Treatments/addTreatments which provides a CURL of
curl -X POST "https:///api/v1/treatments" -H "accept: /" -H "api_secret:stuff" -H "Content-Type: application/json" -d "[{"eventType":"","created_at":"2021-04-10T15:28:00Z","carbs":27,"insulin":3.9}]"
gives an error:
{
"status": 401,
"message": "Unauthorized",
"description": "Invalid/Missing"
}
Any thoughts?
The text was updated successfully, but these errors were encountered: