http-auth-client
v0.4.1
Published
Client side HTTP Authorization header handling
Downloads
302
Maintainers
Readme
HTTP Authentication Client
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