Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Special characters break HTTP basic authentication #333

tizzo opened this Issue · 4 comments

5 participants


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?


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


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

headers: {
  authorization: "Basic " + toBase64(user + ":" + pass)

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

This appears to no longer be an issue:

var request = require('request');


    { user : 'abc', pass : 'a:bc' },
    { user : 'abc', pass : '#abc' },
    { user : 'a@c', pass : 'abcd' }
].forEach(function(auth) {
    request('', {
        auth : auth
    }, function(err, res, body) {
        console.log(auth, err, res && res.statusCode);
@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.