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

**URL:** <https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785>\
**Category:** InfluxDB 2\
**Created:** [December 2, 2021, 8:55am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785 "2021-12-02T08:55:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eliassal](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eliassal](https://community.influxdata.com/u/eliassal)\
**Post date:** [December 2, 2021, 8:55am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/1 "2021-12-02T08:55:46Z")

</div>

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

> **[Bad Gateway Errors](https://community.grafana.com/t/bad-gateway-errors/15883/8)**
>
> Well start by getting some real world data into the database, then you will have something to put on the dashboard.

It never succeeds and get " Error reading influx""

 ![influxErrReading](https://us1.discourse-cdn.com/flex023/uploads/influxdata/original/2X/2/2e99523172b9364a40a7ef675d374c7f56f584e3.jpeg)

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [December 2, 2021, 11:05am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/2 "2021-12-02T11:05:53Z")

</div>

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](https://docs.influxdata.com/influxdb/cloud/security/tokens/create-token/)

Let me know if you run into any more troubles 🙂

---

<div class="post-metadata">

**Author:** ![eliassal](https://avatars.discourse-cdn.com/v4/letter/e/43a26b/32.png) [@eliassal](https://community.influxdata.com/u/eliassal)\
**Post date:** [December 2, 2021, 11:42am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/3 "2021-12-02T11:42:59Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Franky1](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/franky1/32/6666_2.png) [@Franky1](https://community.influxdata.com/u/Franky1)\
**Post date:** [December 2, 2021, 11:52am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/4 "2021-12-02T11:52:57Z")

</div>

> [@eliassal](#):
>
> but tell me, how can we avoid typing everytime those params?

Use a influx config profile and set it as active:

> **[influx - InfluxDB command line interface | InfluxDB OSS v2 Documentation](https://docs.influxdata.com/influxdb/v2/reference/cli/influx/)**
>
> The influx CLI includes commands to manage many aspects of InfluxDB, including buckets, organizations, users, tasks, etc.

---

<div class="post-metadata">

**Author:** ![fatmaj](https://avatars.discourse-cdn.com/v4/letter/f/ea5d25/32.png) [@fatmaj](https://community.influxdata.com/u/fatmaj)\
**Post date:** [April 16, 2023, 5:58pm UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/5 "2023-04-16T17:58:41Z")

</div>

Why when I tried  
_influx bucket list --org paraqom --token MYTOKEN_  
that is in [localhost:8086](http://localhost:8086/signin) , I managed to see list of bucket.  
But when I tried the same command (_influx bucket list --org paraqom --token MYTOKEN_ ) the token of influxdb that is in cloud [https://us-east-1-1.aws.cloud2.influxdata.com/](https://us-east-1-1.aws.cloud2.influxdata.com/)

It gives me this error  
Error: failed to list buckets: 401 Unauthorized: unauthorized access

How to solve this problem?

---

<div class="post-metadata">

**Author:** ![TinkerPHU](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/tinkerphu/32/15806_2.png) [@TinkerPHU](https://community.influxdata.com/u/TinkerPHU)\
**Post date:** [June 21, 2024, 9:23am UTC](https://community.influxdata.com/t/error-failed-to-list-buckets-401-unauthorized-unauthorized-access/22785/6 "2024-06-21T09:23:05Z")

</div>

I had the same issue.  
At some point, I got the error message that I am missing operator level rights.  
For some reason, there was now config available, not even a default.  
I ended up setting up everything from scratch.

If you can’t, try

```auto
influx config create --config-name default --host-url http://localhost:8086 --org <your org here> --active --token <your admin token here>

```

Also this might help: [influxd recovery auth create-operator | InfluxDB OSS v2 Documentation (influxdata.com)](https://docs.influxdata.com/influxdb/v2/reference/cli/influxd/recovery/auth/create-operator/)
