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

Error getting accountId - Invalid base64 - atob is not defined - RequiredHeaderMissing #176

Open
miguefl opened this issue Dec 16, 2024 · 4 comments

Comments

@miguefl
Copy link

miguefl commented Dec 16, 2024

After updating to the last version, v2.7.3, because I had errors after some LibreLikUp changes, It's still failing. Now it looks like it's failing trying to use atob.

Dec 16 16:16:00 diabetes-vm start2.sh[26510]: [error]: Error getting accountId:  Invalid token specified: invalid base64 for part #2 (atob is not defined)
Dec 16 16:16:01 diabetes-vm start2.sh[26510]: [error]: {"message":"RequiredHeaderMissing"}
Dec 16 16:16:01 diabetes-vm start2.sh[26510]: [error]: getting libreLinkUpConnection:  Cannot read property 'data' of undefined

How can I fix it?

Thanks.

@miguefl miguefl changed the title Error getting accountId - Invalid base64 - atob is not defined Error getting accountId - Invalid base64 - atob is not defined - RequiredHeaderMissing Dec 19, 2024
@miguefl
Copy link
Author

miguefl commented Dec 26, 2024

I've fixed it, with a workaround, using postman to log in and get the id, then I calculate the sha256 hex of the id and I modified the code to use it hardcoded as accountId header, then it works. It's a little bit weird, in the original code, it fails to get the id from the jwt token (decoding) so the accountId header is null and the I get the error "RequiredHeaderMissing". I think we can use the id from the login response instead of decoding the jwt token... I will try to refactor the code to make it work in my scenario. I try to investigate why is failing decoding the JWT token too.

Thanks.

@timoschlueter
Copy link
Owner

timoschlueter commented Dec 26, 2024

So the current implementation fails at docoding the jwt? That is strange. Why does it stop working from one day to another? Here in the DE region, it still works for me with 2.7.3.

I am on vacation right now but will certainly look into this as soon as I get back home (December 29).

Thank you so much for investigating this issue!

@miguefl
Copy link
Author

miguefl commented Dec 26, 2024

Hi !! Thanks for your reply. It started to fail when they deprecated the old versions, below 4.12.0 I think. Then I updated the repository because I saw new releases of this uploader but It fails anyways. Then I cloned the repository again, a fresh install, I created the script to run it and I still had errors related to "RequiredHeaderMissing" for the account-id header. The error that I saw before the missing header error was:

Error getting accountId:  Invalid token specified: invalid base64 for part #2 (atob is not defined)

So maybe there is a problem in my google cloud instance, maybe some package to update, I don't know, but It worked fine during the year. I've to take a closer look to see what happening, maybe it's something related with node... The code looks very fine to me and it worked before.

Let's see. If I have any other update I will post it ASAP.

Thanks very much, your project help me a lot to have my glucose metrics in my watch and have the nightscout ready.

@timoschlueter
Copy link
Owner

I released 2.7.4 without the need for jwt-decode. Maybe this fixes your issue?
It certainly is better to extract the accound-id from the LoginResponse instead of decoding the jwt. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants