explodingcamera / subsonic-api

typescript/javascript library for interacting with subsonic-compatible apis
https://www.npmjs.com/package/subsonic-api
MIT License
13 stars 1 forks source link

Login method errors with "Unknown encoding: base64url" #4

Closed Geoxor closed 1 year ago

Geoxor commented 1 year ago

The environment is in Electron v24.1.3, Node v19.1.0 (trying to implement in https://github.com/Geoxor/amethyst)

Sample code:

import { SubsonicAPI } from "subsonic-api";

const api = new SubsonicAPI({
  url: "https://demo.navidrome.org",
  type: "navidrome", // or "generic" or "subsonic"
});

api.login({
  username: "demo",
  password: "demo",
}).then(() => {
  api.getTopSongs({count: 50}).then(songs => console.log(songs));
  console.log("logged in");
}).catch(err => {
  console.log("subsonic error:", err);
});

Error in console:

subsonic error: TypeError: Unknown encoding: base64url
    at Uint8Array.slowToString (index.js:544:32)
    at Uint8Array.toString (index.js:606:23)
    at M (index.js:1:9081)
    at n.E_fn (index.js:1:10196)
    at n.G_fn (index.js:1:10257)
    at n.C_fn (index.js:1:11207)
    at n.R_fn (index.js:1:10408)
    at n.ping (index.js:1:11393)
    at n.login (index.js:1:9663)
explodingcamera commented 1 year ago

Hi! Should be fixed in v2.0.2.