401 Unauthorized: unauthorized access InfluxDB CLI

Hi all,
I have an influxDB installation with UI on windows
Now I’m trying to run CLI commands on the same instance.
So, I downloaded the influx CLI and placed it in the same folder as Influxd.
Next, I followed this guide to create a configuration file by filling in the parameters as follows:
–config-name, I entered the name “login”
–host-url, “http://localhost:8086
–org the organization, used by my user in the UI
–token, I generated an API token in the “API TOKENS” page setting it as “All Acces”
–active, to make it active

But now whatever command I run the message that is shown is the following.

I’m sure I’m doing something wrong, but I can’t figure out what :confused:
Is there anyone who has been in such a situation or who knows how to help me?

influxDB v2.5.1 (git: 5b6fdbf05d) build_date: 2022-11-02T18:06:29Z
influx CLI v2.5.0 (git: 3285a03) build_date: 2022-11-01T16:32:06Z

I think im a “me too” … starting to really regret moving to v2

1 Like

up to be more visible

you need admin token given when you installed it.

generated tokens do not work with CLI.

1 Like

Is there any way to retrieve the admin token?

Hi everyone,
I unlocked my situation with this solution
Instead of logging in with a token I used the credentials I usually use in the GUI.
I know it’s not really a solution, but it worked out for me.

i had to reinstall (make a backup of data via files before) and now i backup all my token everyday via CLI

How to login with the the influx 2 command line? The document is confusing, now just figured it out

  1. create a CLI config
influxdb@develop ~ % influx config create \
  -n config-name \
  -u http://localhost:8086 \
  -p USERNAME:PASSWORD \
  -o MyOrganization
  1. Now use the CLI
influxdb@develop ~ % influx user list
ID			Name
0b0b8f90c305e000	datahub