Skip to content
← Public packages

@kentcdodds/audible

Personal Audible library app — browser re-auth, library, wishlist, NAS archive stub.

README.md

86 lines · 4.6 KB · Markdown

@kentcdodds/audible

Intent

Give Kent / Patch a fork-ready Kody package (and phone-first package app) that talks to Audible’s unofficial API so owned titles can be inventoried and archived to the household NAS — without needing OpenAudible or audible-cli on the machine for day-to-day re-auth. Success means: open the app → Amazon OpenID+PKCE login → paste the maplanding URL → ADP signing auth is stored in package storage (audible-auth-v1); then browse library/wishlist and tap Save to NAS. This package archives owned titles only. It handles the Audible API (Adrm AAXC license + content URL). Home MCP converts to a flat Title.m4b and writes /media/audiobooks.

Share this package as https://kody.codes/@kentcdodds/audible

What it does

  • Phone-first package app: Connect, Library, Wishlist, Archive
  • Browser Amazon OpenID + PKCE + virtual device registration (TypeScript port of mkb79/Audible login/register — no AGPL Python vendored)
  • ADP sign-request auth in pure TypeScript / WebCrypto
  • Auto-refresh access tokens from refresh_token when present
  • Import OpenAudible / audible-cli JSON still supported via fromAuthFile
  • List / search library with On NAS markers + infinite scroll, wishlist add/remove, Adrm AAXC license, Save-to-NAS / bulk remaining via home MCP
  • Auth readiness without leaking secrets (./auth-status)

Connect (human playbook)

  1. Open the hosted package app (publish response hosted_app_url, or Open app on the package page) → Connect tab.
  2. Pick locale (default US) → Connect Audible → finish Amazon login (CAPTCHA / 2FA stay in Amazon’s UI). You may need credentials twice.
  3. Amazon lands on …/ap/maplanding?…&openid.oa2.authorization_code=… (404/error page is expected).
  4. Paste that full URL into the app → Finish connect.
  5. The package registers a virtual Audible device, builds audible-cli-compatible auth JSON, and saves it in package storage (audible-auth-v1) for ADP signing. Optional secretSet as audibleAuth is best-effort for host naming only — after opaque secrets, mounts are placeholders and cannot be JSON.parsed for signing.
  6. Re-auth once after the opaque-secrets platform change (or whenever the virtual device is invalidated / storage is cleared). Access tokens still refresh automatically from refresh_token once Connect has run.

Agent / export equivalent:

  • kody:@kentcdodds/audible/start-auth → { locale? } → { loginUrl, authSessionId }
  • kody:@kentcdodds/audible/complete-auth → { redirectUrl, authSessionId? } → { ok, authStatus } (never returns secret values)

Pastes into /account/secrets/new alone are not enough for ADP signing anymore (opaque secret values). Prefer the Connect flow so keys land in package storage. Host allowlists for api.audible.* / api.amazon.* still matter for outbound calls.

App tabs

TabWhat you get
ConnectLocale picker, Amazon login, paste maplanding URL, auth chip
LibrarySearchable owned titles with infinite scroll, On NAS vs Save to NAS / Re-save, quiet Plus · stream only / Not an audiobook download badges, All / Not on NAS / On NAS chips, reload / pull-to-refresh
WishlistList + add/remove by ASIN (infinite scroll when paginated)
ArchiveSave all remaining (N) bulk archive (confirm + progress + stop) plus per-title Save to NAS → home MCP Title.m4b (Plus / Shows skipped; already-on-NAS skipped; Replace if it already exists / Library Re-save to overwrite)

Done when

  • Browser connect (or imported auth) leaves ./auth-status with signingReady: true
  • App Library lists owned titles without printing tokens
  • Wishlist mutations work
  • Library / ./library-archive-status marks titles already on the NAS (Title.m4b)
  • Archive / ./archive-to-nas saves (or skips) a title on the NAS via home MCP
  • Archive tab / ./archive-remaining counts and can archive all downloadable titles not yet on the NAS
  • Re-auth is rare thanks to refresh_token

Branding

Official Audible orange soundmark paths from the Simple Icons Audible entry (#F8991C). Audible® is a trademark of Amazon.com, Inc. or its affiliates. This package is not affiliated with or endorsed by Amazon or Audible.

Docs