nrk / redis-lua

A Lua client library for the redis key value storage system.
MIT License
731 stars 239 forks source link

missing password parameter in the connection #44

Open aztrock opened 9 years ago

summershrimp commented 9 years ago

you can use client:auth(password)

aztrock commented 8 years ago

redis = require 'redis' client = redis.connect('127.0.0.1', 6379) client.auth(password) /usr/local/share/lua/5.1/redis.lua:371: attempt to index field 'network' (a nil value) stack traceback: /usr/local/share/lua/5.1/redis.lua:371: in function 'send' /usr/local/share/lua/5.1/redis.lua:379: in function 'auth' stdin:1: in main chunk

summershrimp commented 8 years ago

client:auth, not client.auth

mosjin commented 5 years ago

client:auth( password ) works for me, thanks a lot!

joaomateusferr commented 1 year ago

Hey guys, there are a few different ways to authenticate with redis lua and the method shown above is just one of them.

When we configure redis to require a password by changing the redis.conf file and uncommenting the requirepass flag (# requirepass foobared) we use the auth method as below.

redis = require 'redis'
local password = 'mypass'
client = redis.connect('127.0.0.1', 6379)
client:auth(password)

However, if we use the acl with a username and password, we must authenticate as follows.

redis = require 'redis'
local password = 'mypass'
local user = 'myuser'
client = redis.connect('127.0.0.1', 6379)
client:auth(user, password)

I left some links to help if anyone is facing the same difficulties I went through

https://redis.io/commands/auth/ https://redis.io/docs/management/security/acl/