timoschlueter / nightscout-librelink-up

Script written in TypeScript that uploads CGM readings from LibreLink Up to Nightscout.
MIT License
196 stars 249 forks source link

nightscout-librelink-up suddenly reports "invalid authentication token". #143

Open johannes-martin opened 4 months ago

johannes-martin commented 4 months ago

I've been running nightscout-librelink-up sucessfully for about a week now. Tonight at 7:28pm CEST it suddenly stopped working and now reports the following:

[info]: renew token
[error]: "very long string of digits and characters"
[error]: Invalid authentication token. Please check your LibreLink Up credentials Cannot read property 'status' of undefined
[error]: LibreLink Up - No AuthTicket received. Please check your credentials.

The error seems to be caused at line 163 in index.ts: if (response.data.status !== 0)

Any idea what could be causing this? I checked the credentials in the librelink up app - they continue to work there.

AndyLow91 commented 4 months ago

Also seeing the same error here:

[info]: Starting cron schedule: */1 * * * *
[info]: renew token
[error]: "6ZAr80PColog2gvxxlfRUEZMITB2vCQUmFQlPOmfW3u6Ov3lJbcNm0eCPDJU7851qOf9BjnQXqRdUsP3busSDoiavUoRhZLIAWXQvgDqsRGReXboIKOe3EPsuuOgsLMfCErCus22uRaR7iq3LkMF01Z2Id5nc9mdJgm36a4CUlEOBI8pDQ58UGWQnCsSe9cuRjoFZ1ltvTHm9WLFc7q2x7l1CJnEJj55q6T5Qgq7GLKN3GfYmYmSaRsHRA7loeBEXxyndDmPeWUCuO1vzypuB5R2MKkhADE8mtx8lvz2PoyMJqoskSDCWjnDCERWw606N4sn6x8yZdeky2mFH1ZFBo2oAcZLk5MD8vQFzbAAdZLxz2DvgX4wBzrzmFL7WFlIzgU32fWK3VtRxBRTgcA0MErG23LiNGfAVWZKOwXHhAZX1qOCG1gTcWrb8iRpeEK8P693cxgieoMeKS46O252EBrQMAer80NeMnQRIFM6LbUQwLkFjm64YTh7RcESZIJSr5t3ziXAoK1F8UZRu8yNnoLNp1W2e8ubdmlGURANm7JmeIB5ia9yczFevfXHcvKhD62b30nXXdGBo9LLTdSIhsr2osujFcBoJfZADfA9dZSVQxBf96i3U9Q7v3gr0t920uZZjljP8OHEr4sXgNKOoupBzLx1aaJDGH9TTpv12kr7WvWSRchhChy5eHLQzBOp6ih5ygBIdcN19BVMnvyqZTXJbVok97d5wfXPB8q6ztZSn4C0BeUATtNSWVWlt08OOHxr0KTlbz2S0b743xjqRB0pVY0toCQDjHYptLxuCsc97W6lMndFDrr8j60eXZUqMyV8xMOV8EpFGoelL96K4ePf4zxe7Oi0FNfZYQJDqAxrESBhQGiq0YDsKVRMTrHtRQ5C4KydUwGbPReHL2CT19UoalUIWTWMPeczsjK3nf26pGRwFDKrRZqeAKxaGa8wAC9aka0oy30t4AwLXpOc41MMn48yPmZkeUi4vudbuwBdw1nk9HX7NmgC5bAzl5gF71gC75w2ZE8BJ3HN2M26CV13MDC09ffsYkG7cCjkKo1"
[error]: Invalid authentication token. Please check your LibreLink Up credentials Cannot read properties of undefined (reading 'status')
[error]: LibreLink Up - No AuthTicket received. Please check your credentials.
AndyLow91 commented 4 months ago

When I run this locally (in docker) it is working. I have also console.log'd the response.data and can see that the status == 0. But when I'm running the docker container on a remote server, I get the error.

I've just tested this on two remote servers, both in different data centres with different hosting companies in two different parts of the world.

I'll do some more testing...

nocturne1 commented 4 months ago

I just restarted my container again, and it connected fine. Was failing a little while ago as well.

LVDVUGH commented 4 months ago

Same issue here. Has anyone a solution? What do you mean with "container" nocturne?

nocturne1 commented 4 months ago

I'm running nightscout-librelink-up as a docker container on a remote host. Essentially just restarting the service.

AndyLow91 commented 4 months ago

Now successfully running on yet another remote host, Is abbott introducing some rate limiting/IP blocking?

AndyLow91 commented 4 months ago

I successfully ran a few containers on the third remote server that I tried, then started getting blocked again. Now moved over to a fourth and it's working (for now), seems like rate limiting or Ip blocking to me

sircsaba commented 4 months ago

Mine isn't having any isssues ! I use my personal server ...

Sidetone602 commented 4 months ago

I have the same error since around 8pm yesterday. My Librelinkup uses the DE region. I created a new LibreLinkUp account, but still get the error:

[error]: Invalid authentication token. Please check your LibreLink Up credentials Cannot read properties of undefined (reading 'status') [error]: LibreLink Up - No AuthTicket received. Please check your credentials.

I created a completely new Nightscout server using a different provider (first server is on 10be.de, and the second server is on nightscoutpro.com), and I still get the error, so I don't think it can be IP blocking related.

johannes-martin commented 4 months ago

I resolved the problem by moving the service from my google cloud virtual machine to a docker instance I run at home. So to me, too, it looks like it an IP blocking issue.

If they want to target nightscout users, it would seem likely that they block the whole range of IPs used by nightscout.pro.

AndyLow91 commented 4 months ago

@Sidetone602 - If you are running on Nightscout Pro, please email me at support@nightscoutpro.com and I'll set up a manual instance to run this for you.

After some further testing, I can set up many instances on my Home Lab and it works perfectly, but on remote servers, I am having troubles. It looks like Abbott is trying to block out certain subnets of IP's. Domestic IP's would probably interfere with their own LibreLinkUp service, so I believe they are not being blocked for this reason. Just a theory though.

timoschlueter commented 4 months ago

@AndyLow91: from my experience its not that Abbott is blocking IP ranges but rather checks if requests are coming from regions where the user is not actually located. I ran into this issue when i hosted my Nightscout and this sidecar on a US server but tried to access data on the LLU endpoint in germany (region "DE"). I was able to resolve the issue by deploying the sidecar to a server hosted in germany.

AndyLow91 commented 4 months ago

@timoschlueter I've seen similar previously, but i don't think this is the same here. For example, I am now running a number of docker instances on my Home Lab, for many different regions, and they are all working fine now. It's a strange one.

Sidetone602 commented 4 months ago

@AndyLow91: from my experience its not that Abbott is blocking IP ranges but rather checks if requests are coming from regions where the user is not actually located. I ran into this issue when i hosted my Nightscout and this sidecar on a US server but tried to access data on the LLU endpoint in germany (region "DE"). I was able to resolve the issue by deploying the sidecar to a server hosted in germany.

I'm definitely located in Germany :-) The funny thing is, I also use Gluroo which connects just fine to my LibreLinkUp account. It really does seem to target Nightscout only. @AndyLow91 - I'll drop you an email shortly using support@nightscoutpro, thanks very much for the support, it's much appreciated.

zehnBE commented 4 months ago

After 9 Connection, cloudflare block the Server IP.

Blondie-61 commented 4 months ago

After 9 Connection, cloudflare block the Server IP.

What exactly does that mean?

Sidetone602 commented 4 months ago

My LibreLinkUp was logged in using my main Libreview account details. I created a 2nd Libreview account using a different email, and then invited that account to join Librelinkup from the Libre3 app (Click the hamburger icon, connected apps, Librelinkup). In Nightscout, I use the 2nd Libreview account details and it now works. This makes me wonder if it really is IP blocking, because this 2nd account will still be using the same Nightscout server IP address. @AndyLow91 - I was testing using my 10be.de server running Nightscout. If I use my "main" login for libreview/librelinkup, it fails with the auth error, but setting up a second account as a "follower" doesn't block for some reason. It's the same server, using the same range of IP's so it leaves me wondering how the blocking from Abbot (or Cloudflare) is working.

zehnBE commented 4 months ago

@Blondie-61 i have changed to ip6 only and created a lot of subnetworks. Now every instance runs fine and is not blocked. If you make more connections from one IP (3 Librelink-UP Follower phones should be ok), but if you have more in one wifi, cloudflare blocks the IP from you. What i see.

on 10be runs about 100 librelinkup instances, but now every instances gets a new ip6 address and there are a big range. And after a restart or edit, there get a new ip6 address. I hope there dont block the xxx:xxx:xxx-Net.

@Sidetone602 maybe there blocks first the account and after then the IP. I have automatically check now, that if the status !=0 and it looks, that the login failed, that these librelink instance is automatically disabled.

gunpowder62 commented 3 months ago

Hi all

could it be the mandatory 2FA required now?

diego-castilho commented 3 months ago

Hi, all. About 9 hours ago I started to receive this message:

[info]: renew token [error]: LibreLink Up - Logged in to the wrong region. Switch to 'LA' region. [error]: LibreLink Up - No AuthTicket received. Please check your credentials.

I tried logging off and logging on LibreLinkUP and accepting new terms, but it didn't work. I tried to follow the message and change the region to LA, but I received LA is not a supported region.

I'm from Brazil.

diego-castilho commented 3 months ago

Hi, all. About 9 hours ago I started to receive this message:

[info]: renew token [error]: LibreLink Up - Logged in to the wrong region. Switch to 'LA' region. [error]: LibreLink Up - No AuthTicket received. Please check your credentials.

I tried logging off and logging on LibreLinkUP and accepting new terms, but it didn't work. I tried to follow the message and change the region to LA, but I received LA is not a supported region.

I'm from Brazil.

My issue was solved with new release.

gunpowder62 commented 3 months ago

Hi all

could it be the mandatory 2FA required now?

My issue got resolved with the latest Release but I had to install the Container on another host.

salamahi commented 3 months ago

I've had couple of occasions when single heroku pod instance started giving this error. It failed 9/10 times, but always got the connection 1/10 times from heroku. Both times this got resolved by rebooting the heroku pod.

Now I realized that I had also one instance running in 10be. Could be then account based throttling if connections are coming in with same account from multiple networks. Let's see if shutting down the 10be server helps keeping the heroku connection stable.

ThomasQuant commented 2 weeks ago

Also seeing the same error here:

[info]: Starting cron schedule: */1 * * * *
[info]: renew token
[error]: "6ZAr80PColog2gvxxlfRUEZMITB2vCQUmFQlPOmfW3u6Ov3lJbcNm0eCPDJU7851qOf9BjnQXqRdUsP3busSDoiavUoRhZLIAWXQvgDqsRGReXboIKOe3EPsuuOgsLMfCErCus22uRaR7iq3LkMF01Z2Id5nc9mdJgm36a4CUlEOBI8pDQ58UGWQnCsSe9cuRjoFZ1ltvTHm9WLFc7q2x7l1CJnEJj55q6T5Qgq7GLKN3GfYmYmSaRsHRA7loeBEXxyndDmPeWUCuO1vzypuB5R2MKkhADE8mtx8lvz2PoyMJqoskSDCWjnDCERWw606N4sn6x8yZdeky2mFH1ZFBo2oAcZLk5MD8vQFzbAAdZLxz2DvgX4wBzrzmFL7WFlIzgU32fWK3VtRxBRTgcA0MErG23LiNGfAVWZKOwXHhAZX1qOCG1gTcWrb8iRpeEK8P693cxgieoMeKS46O252EBrQMAer80NeMnQRIFM6LbUQwLkFjm64YTh7RcESZIJSr5t3ziXAoK1F8UZRu8yNnoLNp1W2e8ubdmlGURANm7JmeIB5ia9yczFevfXHcvKhD62b30nXXdGBo9LLTdSIhsr2osujFcBoJfZADfA9dZSVQxBf96i3U9Q7v3gr0t920uZZjljP8OHEr4sXgNKOoupBzLx1aaJDGH9TTpv12kr7WvWSRchhChy5eHLQzBOp6ih5ygBIdcN19BVMnvyqZTXJbVok97d5wfXPB8q6ztZSn4C0BeUATtNSWVWlt08OOHxr0KTlbz2S0b743xjqRB0pVY0toCQDjHYptLxuCsc97W6lMndFDrr8j60eXZUqMyV8xMOV8EpFGoelL96K4ePf4zxe7Oi0FNfZYQJDqAxrESBhQGiq0YDsKVRMTrHtRQ5C4KydUwGbPReHL2CT19UoalUIWTWMPeczsjK3nf26pGRwFDKrRZqeAKxaGa8wAC9aka0oy30t4AwLXpOc41MMn48yPmZkeUi4vudbuwBdw1nk9HX7NmgC5bAzl5gF71gC75w2ZE8BJ3HN2M26CV13MDC09ffsYkG7cCjkKo1"
[error]: Invalid authentication token. Please check your LibreLink Up credentials Cannot read properties of undefined (reading 'status')
[error]: LibreLink Up - No AuthTicket received. Please check your credentials.

Is it normal that I don't get a long string in the entry after "renew token"? Like: [error]: and then nothing... Instead of your [error]: "6ZAr80PColog2gvxxlfRUEZM ...