ERR invalid password when the password contains a "+"
See original GitHub issueEnvironment
$ node --version
v12.11.1
$ npm --version
6.11.3
$ npm view ioredis version
4.14.1
Steps to reproduce
Consider the following test:
const connStrDb0 = "redis://[CENSORED]:6380?password=9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY+BVhD1wU=&tls=true";
let redis0;
describe("Checking possibility to use the same Redis with different DBs", () => {
beforeEach(() => {
redis0 = new Redis(connStrDb0);
});
afterEach(() => {
redis0.disconnect();
})
it("should be possible to set the same key on different connections", async () => {
await redis0.set("foo", "bar0");
expect(await redis0.get("foo")).toEqual("bar0");
});
And run it using DEBUG=ioredis:* jest index.test.js
Expected result
The test should pass 😃
Actual result
ioredis has an issue and sends the password with the “+” changed to a space bar - logs attached
ioredis:redis status[CENSORED:6380]: connecting -> connect +264ms
ioredis:redis write command[CENSORED:6380]: 0 -> auth([ '9R6ocWzNBdUK7sern0BDCC72b3rceZmqyrY BVhD1wU=' ]) +1ms
ioredis:redis write command[CENSORED:6380]: 0 -> info([]) +1ms
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
USERID OR PASSWORD CONTAINS INVALID CHARACTERS
USERID OR PASSWORD CONTAINS INVALID CHARACTERS. Reason: (VSE only) Invalid characters were found in the user ID or password fields. Action:.
Read more >Why am I getting an "Invalid Password" error when I enter my ...
You may be entering the password incorrectly. Double check the characters before submitting the password. Also, make sure that there are no spaces...
Read more >When connecting to Redis I get an Invalid Password error
An Invalid Password error occurs when the password being passed with the -a flag is incorrect. If you are getting this error, ...
Read more >ORA-00988: missing or invalid password(s) - Stack Overflow
Turns out one doesn't put the password in single quotes. Double quotes are required if the password contains some special characters.
Read more >“Password incorrect” error - Google Account Help
“Password incorrect” error · Update your app or operating system. If the app or the operating system on your device is out-of-date, you...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I just added two test cases to address this issue: https://github.com/luin/ioredis/commit/66920f1a25b083c9d62e820215654920be3c1052.
The correct usage for passing passwords via URL is to place it in the password part (that’s
user:pass@host
). For your case, I think the correct way is:It’s supported to pass passwords via queries, but passwords need to be encoded first:
Thanks for the hint then!