robberwick / pylibrelinkup

`pylibrelinkup` is a Python client for the LibreLinkUp API, which allows you to interact with the LibreLinkUp service to retrieve glucose data and other related information. This project is a Python implementation inspired by the [libre-link-up-api-client](https://github.com/DiaKEM/libre-link-up-api-client) project.
MIT License
2 stars 0 forks source link

LibreLinkUp quick API question #11

Closed JackDinn closed 1 month ago

JackDinn commented 1 month ago

I just wondered if you know if the Libre developers have changed the API access to https://api-eu2.libreview.io a few hours ago?

I have written a python application that uses access to the API, but tonight their servers went off-line and when they came back on my applications API access had stopped working. Something has definitely changed at their end.

Im sorry to ask you here but i dont know how to do a direct message in github.

it's possible that the API endpoint or required headers have changed. The API might now expect different headers, a different version number, or even a different authentication method.

Are you aware of any changes or where i can find the up to date documentation for accessing the API.

Is yours still working or is it throwing a credential error when you try to access the API?

Best Regards, Jack.

robberwick commented 1 month ago

Hi @JackDinn - i'll pick this up later on and take a look to see if anything has changed. In the meantime it might also be useful to keep an eye on https://github.com/DiaKEM/libre-link-up-api-client to see if any similar issues are reported there. I've just had a quick look and there's nothing at the moment, but that could just mean that nobody has gotten around to raising an issue yet.

JackDinn commented 1 month ago

Hi, and thx for the response.

I have added a question on the link you gave, I did even manage to install his code and run some tests. It is giving the same response. https://github.com/DiaKEM/libre-link-up-api-client/issues/24

I do hope someone much more tech savvy than me can figure this out as i completely depend on this to work to manage my condition :cry:

response: {
    status: 401,
    statusText: 'Unauthorized',
    headers: {
      date: 'Wed, 25 Sep 2024 09:22:27 GMT',
      'content-type': 'application/json; charset=UTF-8',
      'content-length': '37',
      connection: 'keep-alive',
      lvapi: 'v1.15.55',
      vary: 'Origin',
      'x-request-id': 'bc3336ce38f146448559ba9be6251a75',
      'strict-transport-security': 'max-age=15724800; includeSubDomains',
      'cf-cache-status': 'DYNAMIC',
      'set-cookie': [Array],
      server: 'cloudflare',
      'cf-ray': '8c89f32aef97951d-LHR'
    },
tkorkalainen commented 1 month ago

It seems that terms of use needs to be re-accepted. My solution was to log out from LibreLinkUp Android app and re-login. I was able to accept terms of use and API started working again.

robberwick commented 1 month ago

yep, that's what i'm seeing too @tkorkalainen . looking at the response to a {API_DOMAIN}/llu/auth/login request, i see this content, which suggests that the tou needs accepting.

b'{"status":4,"data":{"step":{"type":"tou","componentName":"AcceptDocument","props":{"reaccept":true,"titleKey":"Common.termsO...uYW5kcm9pZCIsImV4cCI6MTcyNzI4MjI2OH0.ljyu3U22kDhINqNLX7hTxWWfBVN57_zR2jJayMDmYaA","expires":1727282268,"duration":3600000}}}\n'

looking at https://libreview-unofficial.stoplight.io/docs/libreview-unofficial/2820132fdbd4f-accept-terms, it looks like the endpoint to direct that request to is https://{API_DOMAIN}/auth/continue/tou, but that 404's for me. until that is worked out, your solution is a great workaround.

JackDinn commented 1 month ago

Guys, you are god sends. This was exactly the solution. Thing was that I had already done the logout and back in on one of my androids but it never presented the EULA, it just re-logged in. However, what I found was that I had to log out of all devices (even my SugarPixel bedroom clock/CGM device) first and then log back in on one android device and it then presented the EULA for me to agree to.

Woohoo. 😊

Next stop (maybe) is to take a look at this NightScout and x-drip, things I have stumbled across on my travels today.