ra1u / redis-dart

fast redis protocol parser and client
MIT License
84 stars 35 forks source link

Where do you pass the auth password #17

Closed Peace-N closed 3 years ago

Peace-N commented 3 years ago

Where do you pass the auth password, i see on the connection instance that there is only host and port required .

ra1u commented 3 years ago

Following https://redis.io/commands/auth you can auth by sending apropriate command accordingly.

I think that something like

RedisConnection conn = new RedisConnection();
conn.connect('localhost',6379).then((Command command){
  command.send_object(["AUTH","<un>","<pass>"])
  .then((var response){
    assert(response == 'OK');
  })
 ...
});

Or in async style like:

RedisConnection conn = new RedisConnection();
Command command = await conn.connect('host',port);
var response =  await command.send_object(["AUTH","<un>","<pass>"]);
assert(response == 'OK');

I have not test this, but I hope this works as expected and let me know how this works for you. Kind regards, Luka,

ra1u commented 3 years ago

@Peace-N Can you please update this issue with any progress that you got so far.