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

"Account-Id" HTTP header (user Id's SHA256) required by 4.11 update #155

Closed gui-dos closed 3 months ago

gui-dos commented 3 months ago

If you set “4.11.0” as the version HTTP header, you receive the reply {“message":"RequiredHeaderMissing”} (status 400) since the recent update of the last week requires a new Account-Id HTTP header and you have to pass the SHA256 digest of the user Id as a 64-char hexadecimal string.

Here is the relevant beautified code from LibreLinkUp 4.11 bundle.js and vendor.js:

headers: Object.assign({}, m, {
    "Content-Type": "application/json",
    "Cache-Control": "no-cache",
    Pragma: "no-cache",
    version: (0, u.getAppVersion)(),
    product: a.gn ? "llu.ios" : "llu.android",
    "Account-Id": ""
})

...

var f;
const w = i.store.getState().user.id;
w && (v.headers["Account-Id"] = (0, y.fN)(w).toString());
z.fN = function Sha256(M) {
    return _Hash(M, "SHA-256")
};