Skip to content

Commit 81eaf56

Browse files
committed
readme: document basic auth usage
Fixes: #57
1 parent a0fe9a3 commit 81eaf56

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,20 @@ const opts = {
254254
get(opts, function (err, res) {})
255255
```
256256

257+
### Basic Auth
258+
259+
```js
260+
const user = 'someuser'
261+
const pass = 'pa$$word'
262+
const encodedAuth = Buffer.from(`${user}:${pass}`).toString('base64')
263+
264+
get('http://example.com', {
265+
headers: {
266+
authorization: `Basic ${encodedAuth}`
267+
}
268+
})
269+
```
270+
257271
### OAuth
258272

259273
You can use the [`oauth-1.0a`](https://github.com/ddo/oauth-1.0a) module to create

0 commit comments

Comments
 (0)