npm / basic-auth
basic-auth
What changed in basic-auth 2 to 3, from its official release notes, upgrade guides and advisories. Also covers @types/basic-auth. Sources checked 2026-11-30.
6 breaking1 new APIs and options1 performance2 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initbasic-auth 38 changes
Breaking changes 4
Removes the default export; use parse(str) instead.
The package is published as ESM, changing the module format developers use when consuming it.
The supported Node.js versions are now >=22.
The parse method now expects a string.
New APIs and options 1
Adds a format method that accepts name and pass.
Performance 1
Parse performance improved by approximately 15%.
Fixes and other changes 2
Validates base64 before decoding, aligning Node.js and native JavaScript decoding behavior.
Adds cross-platform base64 support.
basic-auth 22 changes
Breaking changes 2
The auth(ctx) signature was removed; pass in a header or use auth(ctx.req) instead.
Support for Node.js below 0.8 was dropped.