Skip to content
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

no parameter support for 'auth' #43

Open
drobertus opened this issue Apr 4, 2016 · 1 comment
Open

no parameter support for 'auth' #43

drobertus opened this issue Apr 4, 2016 · 1 comment

Comments

@drobertus
Copy link

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
Copy link
Contributor

chriso commented Apr 4, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants