JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 47
  • Score
    100M100P100Q71415F
  • License MIT

Client side HTTP Authorization header handling

Package Exports

  • http-auth-client

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (http-auth-client) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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