Registry / security / axios-digest

axios-digest

JSON →
library0.3.0jsnpmunverified

Axios wrapper adding Digest Authentication support (RFC 2617). Version 0.3.0 is the latest stable release with TypeScript definitions included. The library wraps axios to automatically handle the WWW-Authenticate challenge, nonce, and response calculation for HTTP Digest access authentication. Unlike manual header construction, it provides a simple class-based interface with methods for GET, POST, PUT, PATCH, DELETE, and HEAD. No additional dependencies beyond the peer dependency axios.

npm install axios-digest
INSTALL
IMPORT
SIG · AXIOS-DIGEST
A
axios-digest
securityjavascriptv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AxiosDigest
import AxiosDigest from 'axios-digest'
const AxiosDigest = require('axios-digest')
Package is ESM-only; default export is the class. CommonJS require on an ESM package may fail in Node < 22 if not configured properly.
AxiosDigest.info
const axiosDigest = new AxiosDigest(username, passwd); const info = axiosDigest.info;
const info = AxiosDigest.info
info is an instance property, not static. Access after construction.
HTTP Methods (post, get, put, patch, delete, head)
axiosDigest.get('/path', config?)
axiosDigest.GET('/path')
Method names are lowercase. Only the six methods are supported; others (like options, trace) are not implemented.

Demonstrates creating an AxiosDigest client and making a GET request with digest authentication.

import AxiosDigest from 'axios-digest'; const username = process.env.USER ?? ''; const password = process.env.PASS ?? ''; const client = new AxiosDigest(username, password); async function main() { try { const response = await client.get('http://httpbin.org/digest-auth/auth/user/pass'); console.log('Success:', response.data); } catch (err) { console.error('Error:', err.message); } } main();
Debug
Known issues
breakingThe library uses the 'realm' from the WWW-Authenticate header; mismatched or missing realm will cause authentication failures.
fix
Ensure the server sends a correct WWW-Authenticate header with a realm. The library parses the header and uses it for the digest response.
affects: >=0.0.1
gotchaOnly six HTTP methods are supported (GET, POST, PUT, PATCH, DELETE, HEAD). Attempting OPTIONS, TRACE, etc. will throw or be undefined.
fix
Use axios directly for unsupported methods, or extend the library.
affects: >=0.0.1
gotchaThe 'config' parameter is an AxiosRequestConfig; it does not support cancel tokens or other advanced Axios features natively.
fix
Pass a pre-configured Axios instance via the customAxios constructor parameter if advanced features are needed.
affects: >=0.0.1
deprecatedThe package has not been updated since 2021; security or compatibility updates may not be applied.
fix
Consider forking or using an alternative like 'axios-auth-digest' with more recent maintenance.
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: AxiosDigest is not a constructor
Importing the package incorrectly, e.g., using named import instead of default import.
fix
Use import AxiosDigest from 'axios-digest' (ESM) or const AxiosDigest = require('axios-digest').default (CJS, but prefer ESM).
Error: No 'WWW-Authenticate' header in response
Server did not respond with a 401 challenge, or response was not handled properly by the library.
fix
Ensure the endpoint requires digest authentication. The library expects a 401 response with a WWW-Authenticate header to trigger the digest handshake.
TypeError: axiosDigest.get is not a function
Using a case-sensitive method name like 'GET' instead of 'get', or attempting to call a method not in the supported list.
fix
Use lowercase method names (get, post, put, patch, delete, head). Only these six are available.
Upgrade
Version history
0.3.0latest on npm
Audit
Dependencies
axiosrequiredPeer dependency for making HTTP requests; axios-digest requires an existing axios instance or the axios library.
Agent activity
32 hits · last 30 days
node
28
OpenAI (training)
1
Resources
axios-digest — npm install axios-digest · libregistry