Skip to content

Black Friday

Annual Pro is $90 for the first year, normally $120. Or start monthly at $6 for two months, then $12.

Ends Dec 4, 11:59 PM PT.

Create an account
โ† Public packages

@danj/audible-auth

Locked Audible gateway using one owner-provisioned Kody login.

FollowFork

IntegrationsTopics: audible, auth, secrets, locked, pkce, openid

Version
5.0.0
License
Published
November 24, 2026
Pinned commit
6b4a7bc
Rating
No ratings yet
Forks
0
Adaptation effort
โ€”

README

Agent docs

@danj/audible-auth

The locked Audible gateway for trusted Kody packages. One user login, audible-login (provider audible, kind login), holds the Audible refresh token. Kody runs the token exchange, so package code never reads a token. A change goes live only after the owner promotes its commit.

EntryWhat it does
Package appShows setup steps, Check connection, and Disconnect Audible.
./statusReports setup state, last success, any failure wait, and the archive switch. It never calls Amazon or Audible.
./requestRuns one allowed operation: Library list or item, or Wishlist list, add, or remove. A Wishlist remove sends two requests. src/policy.ts holds the allowlist.
./creditsReturns the next plan charge and the credits it adds. Audible's account answer holds no credit balance.
./licenseRefuses while NAS archive is off.

./status returns setupState, one of disconnected, setup-needed, waiting, ready, or configured. The first that applies wins. ready means at least one call has succeeded and no counted failure has happened since. reconnectNeeded is true during a wait that only a new provision can fix.

Provision on your Mac

Work from a reviewed checkout of your own locked fork, with Node 26, and keep LICENSE and NOTICE. Never put the final Amazon address or a credential in chat, command arguments, files, or logs.

  1. In the checkout, run npm ci. If the Kody CLI is not signed in, run npx --yes @kodycodes/cli@latest auth login.
  2. Run node scripts/provision-login.mjs --locale ca, with your own marketplace code. Add --with-username only if you sign in to Audible in DE, US, or UK with an Audible username instead of an Amazon account.
  3. Open the sign-in address that the script prints, and sign in. Paste the final browser address into the hidden prompt. The final page may show an error, and its address still works.
  4. If the script reports Login save unconfirmed, stop. Amazon has already registered the device. Check audible-login in Kody Credentials and your Amazon devices, using the printed serial, before you register again.
  5. In Kody Credentials, map audible-login to this package and to each package that imports it, if Kody did not.
  6. Open the package app and select Check connection.

To reconnect, provision again. A new registration clears any failure wait and any earlier Disconnect.

Check connection and Disconnect

Check connection sends one Library call for one row. ./status alone does not prove that Audible answers.

Disconnect Audible asks for confirmation, removes this package's device from your Audible account, and then blocks further calls. Then delete audible-login in Kody Credentials. If the removal fails, the login stays and you can try again. After a Disconnect, only a new provision reconnects.

Use from another package

Add "@<your-scope>/audible-auth": "*" to kody.dependencies, import kody:@<your-scope>/audible-auth/request or another entry, and add this to the importing app's kody.app:

"capabilities": ["secretList"]

Every entry that opens the login reads its metadata through secretList. To send users to setup, link the package app, optionally with a return URL: https://audible-auth--<handle>.kody.run/?return=<app URL>. The page offers the return link only for an https app URL, with no port or credentials, on <leaf>--<handle>.kody.run or <handle>.kody.run, where <handle> is this package's owner.

Failure waits

A counted failure starts a 30-minute wait, and each further one doubles it, up to 6 hours. A Kody login failure, an HTTP 401 from Audible, and two sent requests in a row that use up the call's 20-second budget with no answer each count once. Other errors and Kody's own login pause do not count. During a wait, calls fail at once and name the time to try again, and Disconnect still works. A new provision, a confirmed Disconnect, or a later success clears the wait.

Security posture

Importers share this package's JavaScript realm, so the boundaries guard against mistakes in trusted code, not hostile code. No entry returns login links, pasted addresses, tokens, signing material, or credential rows, and errors never carry Audible's text.

NAS archive

NAS archive is off (ARCHIVE_ENABLED = false in src/config.ts), so ./license refuses.

Turning NAS archive on

Setting the switch to true is not enough. Provisioning saves no signing material and no device record, and nothing calls saveArchiveSigning. A separate reviewed design must add both first.

Publish and Promote

On the owner's word, run scripts/push-main.sh on main. It tests a clean export of the commit, pushes to origin, and publishes.

  • published or already_published needs no Promote.
  • locked or approval_required prints the only valid Promote link as its last line.
  • Any other result is a failure. Do not Promote.

After a Promote, republish every package that imports this one. Each bundles a snapshot.

Local fake and checks

fake/ implements ./status, ./request, ./credits, and ./license, plus a local-only ./seed. An importing app's local checks use it when you set AUDIBLE_AUTH_DIR=<this checkout>. npm test and npm run typecheck run offline and do not prove live header compatibility.

License

AGPL-3.0-only; see LICENSE. The login, registration, signing, and voucher logic follow mkb79/Audible, by way of Kent C. Dodds' MIT-licensed TypeScript port @kentcdodds/audible. NOTICE keeps the credits.

Report this listing

Log in to report this listing.