Trello attachment download returning 401 unauthorized permission requested

I have a simple script that attempts to download attachments on cards that include “template” as a prefix and are an svg.

I generated my token with https://trello.com/1/authorize?expiration=never&scope=read,write&response_type=token&key=MYKEY.

I’m aware of the access to S3 announcement https://community.developer.atlassian.com/t/authenticated-access-to-s3/40647.

trello.get("/1/lists/{idList}/cards", (err, data) => {
  for (const card of data) {
    trello.get("/1/cards/" + card.id + "/attachments", (err, data) => {
      for (const file of data) {
        if (file.mimeType != "image/svg+xml") {
          continue;
        }

        const prefix = file.name.split("-")[0];

        if (prefix === "template") {
          trello.get(
            "/1/cards/" +
              card.id +
              "/attachments/" +
              file.id +
              "/download/" +
              file.name,
            (err, data) => {
              console.log(data);
            }
          );
        }
      }
    });
  }
});

I then get a 401 unauthorized permission requested and I’m unsure why. Is this something to do with my trello subscription (14 day trial) or some setting in trello. What am I missing?

Thanks

Xổ số miền Bắc