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

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

How to solve this problem?


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 ( and I used exactly that token in command:
influx bucket list --org <org_name> --token <API_Token>

Maybe I should use other command?


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 \
  -t mySuP3rS3cr3tT0keN \
  -o example-org

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


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


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