http-auth-client

0.4.1 • Public • Published

HTTP Authentication Client

pipeline status coverage report

This library parses the www-Authenticate request header(s) and provides the Authorization response header value.

Unlike other libraries it does not do the request itself so it is not tied to any particular request library.

It currently supports HTTP Basic and HTTP Digest authentication.

Usage

TODO

  • do a request using your favourite request library.
  • get a 401 response
  • get the www-authenticate header(s)
const Auth = require('http-auth-client')
 
// parse request header
var challenges = Auth.parseHeaders(req.headers['www-authenticate'])
var auth = Auth.create(challenges)
 
// once you have the username and password
auth.credentials(username, password)
 
// do an authenticated request
req.set("Authorization", auth.authorization("GET", "/test"))

Auth

TODO

Basic

TODO

Digest

TODO

License

MIT

(C) Fozi

/http-auth-client/

    Package Sidebar

    Install

    npm i http-auth-client

    Weekly Downloads

    118

    Version

    0.4.1

    License

    MIT

    Unpacked Size

    21.3 kB

    Total Files

    10

    Last publish

    Collaborators

    • fozi