Failed to list buckets: 401 Unauthorized: unauthorized access

I downloaded and installed influxDB 2. I tried
influx bucket list --org paraqom --token MYTOKEN
in localhost:8086 , I managed to see list of bucket.
But when I tried the same command (influx bucket list --org paraqom --token MYTOKEN ) for influxdb that is in cloud https://us-east-1-1.aws.cloud2.influxdata.com/

I got this error message:
Error: failed to list buckets: 401 Unauthorized: unauthorized access

How to solve this problem?

Hi,

It is the problem with token, I also has faced the same problem. Just check the token in the front end GUI and config it and it will work

I am sure the token that I am using is right. How can I config the token?
I have token in API Token in GUI influxdb (https://us-east-1-1.aws.cloud2.influxdata.com/) and I used exactly that token in command:
influx bucket list --org <org_name> --token <API_Token>

Maybe I should use other command?

Hi,

First delete the config in CLI and create a fresh token in UI and create the config in CLI with the syntax as below

influx config create --active \
  -n config-name \
  -u https://us-west-2-1.aws.cloud2.influxdata.com \
  -t mySuP3rS3cr3tT0keN \
  -o example-org

The organization name must be same in the config and UI.

Regards
Sudheer

I am using influxdb v2. Where should I save the config file?

Hi,

You have to write the above code for config file creation in CLI(Command Line Interface) and run it.

Regards
Sudheer