I'm getting this exception when running the example.
Response status code does not indicate success: 401 (Unauthorized)
It's probably because the following URL:
http://localhost:8086/query?q=show%20databases
Returns:
{"code":"unauthorized","message":"unauthorized access"}
Even just calling this code gives me the same exception:
var client = new InfluxClient(new Uri("http://localhost:8086"), "administrator", "administrator");
await client.ShowDatabasesAsync();
I guess it is because I need to include the token as part of the client request - but I can't work out how to do this from the client? Where do I specify a token for my administrator user?
I have posted more details on my InfluxDB2 setup here:
https://community.influxdata.com/t/getting-started-with-influxdb-and-docker/16989
Update
The help states that: "InfluxDB 2.0 requires authentication and does not support the InfluxDB 1.x auth-enabled = false configuration option.
I have tried adding the token for the administrator to:
/root/.influxdbv2/config
But it still keeps returning with the 401 error..
# ls -l
total 124
-rw------- 1 root root 513 Dec 1 16:14 configs
drwxr-xr-x 4 root root 4096 Dec 1 15:57 engine
-rw------- 1 root root 131072 Dec 1 16:15 influxd.bolt
# pwd
/root/.influxdbv2
# cat configs
[administrator]
url = "http://localhost:8086"
token = "ZjUBmuoMC-Y-MQqESsS8XqxTyVryoNg1-xQQsuY-Alw2S-zH4DE6hXpkSu-J6DTW9mM7cJf7wG308KoZ2Dp2HQ=="
org = "AdvancedEnergy"
active = true
Any hints/tips on if this can be fixed on the client-side appreciated - and apologies for the noob question!
Isn't this a stumbling block for anyone using InfluxDB2?
For the record..
This is how I've setup InfluxDB from the command line..
Pull influxdb2 to the local filesystem and create a new docker container from it (Run from cmd.exe)
docker pull quay.io/influxdb/influxdb:v2.0.2
docker run --name influxdb -p 8086:8086 quay.io/influxdb/influxdb:v2.0.2
Then in the docker container CLI:
Setup the users, bucket and org names. (See 'influx setup -h')
influx setup --skip-verify --bucket sandbox --org MyOrgName --username administrator --password administrator --retention 0 --token UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisT==
Then we need to add the token to /root/.influxdbv2/config file - otherwise we need provide it for every request.. (See 'influx config create -h')
influx config create --active --org MyOrgName --config-name administrator --host-url http://localhost:8086 --token UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisToken_UseThisT==
I'm getting this exception when running the example.
Response status code does not indicate success: 401 (Unauthorized)It's probably because the following URL:
http://localhost:8086/query?q=show%20databasesReturns:
{"code":"unauthorized","message":"unauthorized access"}Even just calling this code gives me the same exception:
I guess it is because I need to include the token as part of the client request - but I can't work out how to do this from the client? Where do I specify a token for my administrator user?
I have posted more details on my InfluxDB2 setup here:
https://community.influxdata.com/t/getting-started-with-influxdb-and-docker/16989Update
The help states that: "InfluxDB 2.0 requires authentication and does not support the InfluxDB 1.x auth-enabled = false configuration option.
I have tried adding the token for the administrator to:
/root/.influxdbv2/configBut it still keeps returning with the 401 error..
Any hints/tips on if this can be fixed on the client-side appreciated - and apologies for the noob question!
Isn't this a stumbling block for anyone using InfluxDB2?
For the record..
This is how I've setup InfluxDB from the command line..
Pull influxdb2 to the local filesystem and create a new docker container from it (Run from cmd.exe)
Then in the docker container CLI:
Setup the users, bucket and org names. (See 'influx setup -h')
Then we need to add the token to /root/.influxdbv2/config file - otherwise we need provide it for every request.. (See 'influx config create -h')