Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Special characters break HTTP basic authentication #333

Closed
tizzo opened this Issue · 4 comments

5 participants

@tizzo

It seems that characters that are meaningful in a URL (:#?@) if used in a password cause basic authentication to fail. I haven't had time to dig in and figure out why, for now I'm working around it by building the auth header myself and setting it in my request options, but I thought I should report it here in case others are having the same issue.

The parsing error seems to cause the basic auth handling code not to be run because the url isn't identified as having auth so the necessary auth properties never get populated. Probably a bad regex somewhere earlier on?

@tamsler

I have this issue as well. If the "user" string contains special characters such as '@', it doesn't work.

@contra

Also having this issue - you guys can always make your own base64 auth token by doing

headers: {
  authorization: "Basic " + toBase64(user + ":" + pass)
}
@mikeal
Owner

Is this still an issue?

This is so old I'm closing, if it is actually still an issue just let me know and I'll re-open.

@mikeal mikeal closed this
@nylen nylen self-assigned this
@nylen
Owner

This appears to no longer be an issue:

var request = require('request');

require('request-debug')(request);

[
    { user : 'abc', pass : 'a:bc' },
    { user : 'abc', pass : '#abc' },
    { user : 'a@c', pass : 'abcd' }
].forEach(function(auth) {
    request('http://nylen.tv/public/test-auth.php', {
        auth : auth
    }, function(err, res, body) {
        console.log(auth, err, res && res.statusCode);
        console.log(body);
    });
});
@nylen nylen removed their assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.