Skip to content

Commit

Permalink
Add documentation about auth.bearer
Browse files Browse the repository at this point in the history
  • Loading branch information
phedny committed Apr 11, 2014
1 parent f1bb537 commit ba51a26
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Expand Up @@ -136,6 +136,14 @@ request.get('http://some.server.com/', {
'sendImmediately': false
}
});
// or
request.get('http://some.server.com/').auth(null, null, true, 'bearerToken');
// or
request.get('http://some.server.com/', {
'auth': {
'bearer': 'bearerToken'
}
});
```
If passed as an option, `auth` should be a hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). The method form takes parameters `auth(username, password, sendImmediately)`.
Expand All @@ -144,6 +152,8 @@ If passed as an option, `auth` should be a hash containing values `user` || `use
Digest authentication is supported, but it only works with `sendImmediately` set to `false`; otherwise `request` will send basic authentication on the initial request, which will probably cause the request to fail.
Bearer authentication is supported, and is activated when the `bearer` value is available. The value may be either a `String` or a `Function` returning a `String`. Using a function to supply the bearer token is particularly useful if used in conjuction with `defaults` to allow a single function to supply the last known token at the time or sending a request or to compute one on the fly.
## OAuth Signing
```javascript
Expand Down

0 comments on commit ba51a26

Please sign in to comment.