401 Unauthorized" error problem when accessing InfluxDB with a valid access token

Hello,

I am currently experiencing a problem when accessing InfluxDB with a valid access token. Every time I try to use commands such as influx org list, I get a "401 Unauthorized" error.

Here is an example of a command I tried and the error I received:

$ influx org list
Error: failed to list orgs: 401 Unauthorized: unauthorized access

I have already done the initial configuration successfully using the influx config command. I have verified that the ~/.influxdbv2/configs configuration file contains the correct information.

I am open to any suggestions or advice on how to solve this problem. Please let me know if you need more information to help me find a solution.

PS : influx config
Active Name URL Org

Thank you in advance for your help!

Hi,

It is the problem with token. I think you have entered the wrong token. Enter the correct token in config creation and check

Regards
Sudheer

Thank you for your reply,

Here is what I am trying to launch:

influx config create --config-name Teams\
  --host-url http://localhost:8086
  --org My_Org_name\
  --token Token_Generated_Randomly\
  --active

but even after this command, I get the same error. And when I look in the cat ~/.influxdbv2/configs, the token part is filled.

Hi,

Check the token in the config create and the token from where you have taken are both same version and matching. Then it will work. I also faced the same issue.

Regards
Sudheer

Re,

I assure you that the token is the right one, and despite that, it doesn’t work. I don’t understand why.

Regards

Hello, Did you get any resolution? I’m getting the same error when trying to setup Python.

I am having the same issue - brand new all access token for InfluxDB (IOx), but attempting to use the token in any capacity results in a 401 Unauthorized. I have tried using it with the influx cli, telegraf and grafana and cannot get it to work correctly.

Has anyone figured out this issue yet?

Hi everyone,

Unfortunately I don’t have an answer for you :frowning_face: I still haven’t been able to correct it.

Hi,

Try the below syntax

influx config create --active \
  -n config-name \
  -u http://localhost:8086 \
  -t mySuP3rS3cr3tT0keN \
  -o example-org

It will work. Check the token also by refreshing it and match the tokens with UI and CLI

Regards
Sudheer
1 Like

Facing the same issue , I’m able to connect from my code but CLI keeps giving me an 401 Unauthorised access error. I have my token defined in a property file in my code but when I copy paste it to the command line it still fails. Influx is quite painful to use…