putdotio / putio-js

JavaScript SDK for interacting with the put.io API.
MIT License
21 stars 2 forks source link

PutioAPI.Files.Upload 401 but PutioAPI.Account.Info() works #61

Closed ptheofan closed 1 year ago

ptheofan commented 1 year ago

Hi, I do not understand what I am doing wrong. I initialize the API client like this

      const putioConfig = this.configService.get('putio');
      this.api = new PutioAPI({
        clientID: putioConfig.clientId,
      });
      this.api.setToken(putioConfig.oAuthToken);

with this API when I call the Account.Info() it works perfectly as expected.

  const accountInfo = await putio.Account.Info();
  this.logger.log(`Uploading as ${accountInfo.data.info.username}`);

However when I call the Files.Upload(...) I get 401

      await api.Files.Upload({
        file: absolutePath,
        fileName: filename,
        parentId: targetFolderId,
      });

is there some issue with the sdk or am I doing something wrong?

altaywtf commented 1 year ago

hey @ptheofan it's on me... 😞 working on a fix now!

altaywtf commented 1 year ago

should be fixed in v8.35.1