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

Add support for Auth with username & password (Redis 6) #1097

Closed
gkorland opened this issue Apr 6, 2020 · 10 comments · Fixed by #1130
Closed

Add support for Auth with username & password (Redis 6) #1097

gkorland opened this issue Apr 6, 2020 · 10 comments · Fixed by #1130
Assignees

Comments

@gkorland
Copy link
Contributor

gkorland commented Apr 6, 2020

No description provided.

@techpanga
Copy link

I am able to get this worked by passing below in new Redis({})... Hope this helps.

password: ['user','password']

@gkorland
Copy link
Contributor Author

@techpanga is seems like it can work as a workaround, but it doesn't feel like good solution for the long term

@luin luin self-assigned this Apr 13, 2020
@luin luin added the Redis 6.0 label Apr 13, 2020
@gkorland
Copy link
Contributor Author

@techpanga also it seems like all the user must have +info on their ACL otherwise it fails when creating the connection.

[ioredis] Unhandled error event: ReplyError: NOPERM this user has no permissions to run the 'info' command or its subcommand
    at parseError (/home/guy/redisclients/TestIoRedis/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/home/guy/redisclients/TestIoRedis/node_modules/redis-parser/lib/parser.js:302:14)

@techpanga
Copy link

@gkorland , Yes. it is workaround only. Thank you.

@luin
Copy link
Collaborator

luin commented Apr 19, 2020

Hey @gkorland @techpanga, actually giving password a ['user', 'password'] does work as expected and I think what we need to do is just documenting this usage.

For the NOPERM error, if the user doesn't have +info you should disable enableReadyCheck option like new Redis({ enableReadyCheck: false }).

wdyt?

@asyrique
Copy link
Contributor

asyrique commented May 5, 2020

@luin This workaround only works if you're initializing ioredis using the new Redis({options})approach and passing in the password key in the options object.

However, we're initializing ioredis using the url string approach, passing in something like redis://foo:bar@somehost:someport, and this now fails (previously with Redis <6, we'd pass in the password without a user, i.e. redis://:bar@somehost:someport).

I'd be happy to submit a PR for this that would fix the the URL string parsing as well as adding an extra optional option user to the options object, if you're not already working on it.

Let me know!

@luin
Copy link
Collaborator

luin commented May 5, 2020 via email

@ioredis-robot
Copy link
Collaborator

🎉 This issue has been resolved in version 4.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@danieltseitlin
Copy link

danieltseitlin commented Jun 25, 2020

is this also supported in the @types/ioredis as well? can't see to be able to pass password a ['user', 'password']

@reshreshus
Copy link

A workaround would be to use a connection string

    RedisModule.forRoot({
      type: 'single',
      url: 'redis://default:password@localhost:6379',
    }),

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

Successfully merging a pull request may close this issue.

7 participants