-
Notifications
You must be signed in to change notification settings - Fork 104
Adding basic_auth support #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
} | ||
}, | ||
|
||
basic_auth: settings.basic_auth |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename the option to basicAuth
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the key basic_auth
is defined in https://github.com/baalexander/node-xmlrpc/blob/master/lib/client.js#L61 so cannot be changed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh you mean the key we use in our side of the config..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw... there are some more "misnamed" options in the game. as it stands right now, even when using basicAuth
as a key the config would look like
{
"url": "https://example.com/",
"username": "test123",
"password": "xdsfadsf",
"basicAuth": {
"user": "testr5z57",
"pass": "asdfadsf"
}
}
so username vs. user
and password vs. pass
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to avoid the name mismatch I would suggest using
// ....
this.rpc = xmlrpc[ parsedUrl.secure ? "createSecureClient" : "createClient" ]({
host: settings.host || parsedUrl.host,
port: parsedUrl.port,
path: parsedUrl.path,
// Always set Host header in case we're pointing to a different server
// via settings.host
headers: {
Host: parsedUrl.host
},
basic_auth: settings.basicAuth ? {
user: settings.basicAuth.username,
pass: settings.basicAuth.password
} : null,
});
// ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
submitted #47
also need support for basic auth... so +1 |
Hi,
My Wordpress installation is protected by a Basic Authentication, so here is a fix to support Basic Auth.
Cheers,