amazon-kindle-bulk-downloader: Failed to parse CRSF token

I am getting the following error:

$ bun run src/index.ts
Getting credentials
Got credentials
Filling username
Filling password
69 |   const cookie = (await page.browser().cookies())
70 |     .map((c) => c.name + "=" + c.value)
71 |     .join(";");
72 |   // @ts-expect-error - This is set by the page
73 |   const csrfToken = await page.evaluate(() => window.csrfToken);
74 |   if (!csrfToken) throw new Error("Failed to get csrfToken");
                             ^
error: Failed to get csrfToken
      at <anonymous> (/Users/<mymacusername>/amazon-kindle-bulk-downloader/src/index.ts:74:25)

Bun v1.2.2 (macOS arm64)
error: script "start" exited with code 1

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (1 by maintainers)

Most upvoted comments

Try bun run start --baseUrl https://www.amazon.com/ --manualAuth true … that did it for me.

@laststrawman this did it for me, too. Note: @psotos specifically I ran bun run start --manualAuth --baseUrl "https://www.amazon.com"

I got this until I deleted my Passkey. It’ll prompt you to make a new one the next time you log in.

I encountered this because I have not given Amazon my telephone number. Manual login worked great. Thank you!

Did you try bun run start --baseUrl https://www.amazon.com/ ? The baseUrl is necessary.