I can't seem to find a solution to this issue, I have a database on mlab I should access with a password containing a backslash \
character.
I've tried using some of the suggestions in this thread, basically encoding manually the password or using an encoding function, but authentification fails nonetheless.
Assuming my password is password\
Here's what I've noted:
if my connection URL is :
mongodb://username:password\@dsXXXXXX.mlab.com:YYYYY/my_db
I obviously have an issue with the escape character as with any javascript string,mongodb://username:password\\@dsXXXXXX.mlab.com:YYYYY/my_db
returns an errorError: Password contains an illegal unescaped character
,mongodb://username:${encodeURIComponent("password\\")}@dsXXXXXX.mlab.com:YYYYY/my_db
I getError: Password contains an illegal unescaped character
along withthe options [uri_decode_auth] is not supported mongoose
(because I am trying to decode inmongoose.connect
as such:mongoose.connect(config.database, { //config.database contains the URL above uri_decode_auth: true }, function(err, db) {} );
mongodb://username:Simplifide35%5C@dsXXXXXX.mlab.com:YYYYY/my_db
by using this website returnsMongoError: Authentication failed.
Connecting with options like so:
mongoose.connect("mongodb://@dsXXXXXX.mlab.com:YYYYY/my_db", {user: 'username', pass: "password\\"}, ()=>{});
does not work either with the encoded
password%5C
norpassword\
.
What are my options aside from changing the password? What am I missing?
Thanks.