Error: failed to list buckets: 401 Unauthorized: unauthorized access

Hi, I downloaded and installed influxDB 2, I was able to access the GUI and create a user and org as well as a bucket. However, in powershell, when I issue the following command

.\influx.exe bucket list --org-id 87e217ef3c4bb714
I get the following error

Error: failed to list buckets: 401 Unauthorized: unauthorized access

What authorization needed and how I can authorize/grant access, knowing that when I see the log when I start influxDB, it uses my windomain\user

2021-12-01T18:08:40.029578Z info Welcome to InfluxDB {“log_id”: “0Y9nnGNG000”, “version”: “2.1.1”, “commit”: “657e1839de”, “build_date”: “2021-11-09T03:03:48Z”}
2021-12-01T18:08:40.378440Z info Resources opened {“log_id”: “0Y9nnGNG000”, “service”: “bolt”, “path”: “C:\Users\salam.SALAM\.influxdbv2\influxd.bolt”}
2021-12-01T18:08:40.378440Z info Resources opened {“log_id”: “0Y9nnGNG000”, “service”: “sqlite”, “path”: “C:\Users\salam.SALAM\.influxdbv2\influxd.sqlite”}


and somewhere else I have in the screen log

2021-12-01T18:47:36.098671Z info Unauthorized {“log_id”: “0Y9nnGNG000”, “error”: “token required”}
2021-12-01T18:47:54.475921Z info Unauthorized {“log_id”: “0Y9nnGNG000”, “error”: “token required”}
2021-12-01T18:48:12.669764Z info Unauthorized {“log_id”: “0Y9nnGNG000”, “error”: “token required”}

From where or how the user log_id": “0Y9nnGNG000” was created and what is its role, I don’t see it in the users tab in the GUI

At the same time (I have grafana and influx running on the same box), and after following instructions to add a data source in grafana using FLUX at

It never succeeds and get " Error reading influx""

Hi @eliassal,
You need to generate a token for the organisation/buckets you are trying to speak to. Create an API token in InfluxDB | InfluxDB Cloud Documentation

Let me know if you run into any more troubles :slight_smile:

Correct and thanks, I found the token used it on the command line and was able to connect using the following statement,

.\influx.exe bucket list --org-id 87e217ef3c4bb714 --token 9k4ZE0jyZkUFFtFhdzrg5HEdjCYWKe_…

but tell me, how can we avoid typing everytime those params?

Use a influx config profile and set it as active:

https://docs.influxdata.com/influxdb/v2.1/reference/cli/influx/#provide-required-authentication-credentials

1 Like