https://github.com/inorganik/digest-auth-request
Make digest-auth requests with vanilla javascript
https://github.com/inorganik/digest-auth-request
digest-authentication javascript
Last synced: 10 months ago
JSON representation
Make digest-auth requests with vanilla javascript
- Host: GitHub
- URL: https://github.com/inorganik/digest-auth-request
- Owner: inorganik
- License: mit
- Created: 2014-02-28T17:29:21.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-08-10T22:49:42.000Z (almost 5 years ago)
- Last Synced: 2025-07-28T06:53:00.812Z (11 months ago)
- Topics: digest-authentication, javascript
- Language: JavaScript
- Homepage:
- Size: 126 KB
- Stars: 71
- Watchers: 9
- Forks: 50
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
Digest Auth Request
===================
Make digest-auth ajax requests with javascript. Only depency is [CryptoJS MD5](https://code.google.com/p/crypto-js/#MD5).
More info on Digest Auth: http://en.wikipedia.org/wiki/Digest_access_authentication
Currently only supports "auth" quality-of-protection type.
### Usage:
GET request:
```js
var url = 'http://example.com/protected-resource';
// create digest request object
var getRequest = new digestAuthRequest('GET', url, 'username', 'password');
// make the request
getRequest.request(function(data) {
// success callback
// do something with the data
},function(errorCode) {
// error callback
// tell user request failed
});
// make additional GET requests here...
```
POST request:
```js
var postData = {
address: '123 main st.',
city: 'Denver',
state: 'Colorado'
}
// create new digest request object
// because method (POST vs GET) is different
// otherwise we could re-use the first one
var postReq = new digestAuthRequest('POST', url, 'username', 'password');
postReq.request(function(data) {
// success callback
// data probably a success message
},function(errorCode) {
// error callback
// tell user request failed
}, postData);
```
### Toggle console logging
Out of the box digestAuthRequest.js has logging turned on so you can debug. Set `loggingOn` to false to disable it.
### Contributing
1. Make edits to `digestAuthRequest.js` in the root
1. In terminal, run `yarn build` or simply `gulp`.