no parameter support for 'auth'
Opened this issue · 1 comments
drobertus commented
I am trying to perform a curl command to a RabbitMQ broker- this requires passing the credentials, but there is no client support for 'auth'
chriso commented
I'm not sure what auth scheme RabbitMQ uses? Is it http basic auth?
The client passes through any options it doesn't recognize. You'd first look at man curl
to find the appropriate command line options/flags:
-u, --user <user:password> Specify the user name and password to use for server authentication. Overrides -n, --netrc and --netrc-optional. If you simply specify the user name, curl will prompt for a password. The user name and passwords are split up on the first colon, which makes it impossible to use a colon in the user name with this option. The password can, still.
In this case we want to send the username and password, separated by a colon, using the user
command line flag. httpbin.org
has a page where we can test basic auth. To test logging in with foo/bar we can make a request to http://httpbin.org/basic-auth/foo/bar
curl.request({
'url': 'http://httpbin.org/basic-auth/foo/bar',
'user': 'foo:bar'
}, function (err, response) {
if (err) throw err;
console.log(response);
});
You'll get a successful 200 Ok
response rather than a 401 Unauthorized
.