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

AUTH with username and password always fails #32

Open
yohayg opened this issue Jan 12, 2025 · 1 comment
Open

AUTH with username and password always fails #32

yohayg opened this issue Jan 12, 2025 · 1 comment

Comments

@yohayg
Copy link
Contributor

yohayg commented Jan 12, 2025

I have a setup that requires both username and password for memorydb in aws
redis-cli works fine: redis-cli -c -h my-redis --user my-user --pass mypassword

My redis pipline options contains both the username and password with a single blank space.
This setup doesn't seem to doesn't work:

{
  Password: fmt.Sprintf(`%s %s`, redisUser, redisPass)
}

It seems like the following code need to be changed from:

if conn.opts.Password != "" {
    req, _ = redis.AppendRequest(req, redis.Req("AUTH", conn.opts.Password))
}

to

if conn.opts.Password != "" && conn.opts.Username != ""  {
    req, _ = redis.AppendRequest(req, redis.Req("AUTH", conn.opts.Username, conn.opts.Password))
} else if conn.opts.Password != "" {
    req, _ = redis.AppendRequest(req, redis.Req("AUTH", conn.opts.Password))
}

@yohayg
Copy link
Contributor Author

yohayg commented Jan 12, 2025

PR: #33

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

No branches or pull requests

1 participant