Skip to content

Commit

Permalink
Support HTTP basic authentication
Browse files Browse the repository at this point in the history
Closes gh-47
Closes gh-36
  • Loading branch information
staabm authored and scottgonzalez committed Jul 12, 2016
1 parent 5f051d8 commit 2b19238
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/wordpress.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ function Client( settings ) {
// via settings.host
headers: {
Host: parsedUrl.host
},
basic_auth: !settings.basicAuth ? null : {
user: settings.basicAuth.username,
pass: settings.basicAuth.password
}
});
this.blogId = settings.blogId || 0;
Expand Down
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@ Creates a new client instance.
* `host` (optional): The actual host to connect to if different from the URL, e.g., when deploying to a local server behind a firewall.
* `blogId` (optional; default: `0`): The blog ID for the WordPress install.
* `rejectUnauthorized` (optional; default: `true`): A boolean indicating whether Node.js should automatically reject clients with invalid certificates. See [tls.createSecurePair()](https://nodejs.org/api/tls.html#tls_tls_createsecurepair_context_isserver_requestcert_rejectunauthorized_options) in Node's documentation.
* `basicAuth` (optional): An object holding HTTP basic authentication credentials.
* `username`: The username for the HTTP basic auth.
* `password`: The password for the HTTP basic auth.

#### wordpress.Client

Expand Down

0 comments on commit 2b19238

Please sign in to comment.