Search code examples
rubyinfluxdb

Influxdb authentication fail using Ruby


I am trying connect to influxdb using influxdb-ruby gem.

with:

influx -username admin -password secret 
> SHOW DATABASES;
name: databases
---------------
name
_internal
metrics

works fine.

But if I try with Ruby:

client = InfluxDB::Client.new(host: "host", port: 8086, database: "metrics", user:"admin", password: "secret")
client.list_databases
InfluxDB::AuthenticationError: {"error":"authorization failed"}

Any tip here ?

Thanks in advance


Solution

  • You must replace the user argument by username.

    client = InfluxDB::Client.new(host: "host", port: 8086, database: "metrics", username:"admin", password: "secret")