influxdb-python icon indicating copy to clipboard operation
influxdb-python copied to clipboard

Authorization error against InfluxDB 2.0

Open rajahaidar opened this issue 4 years ago • 5 comments

  • InfluxDB version: 2.0
  • InfluxDB-python version: e.g. 5.3.1
  • Python version: 3.9
  • Operating system version: Docker on MacOS

When upgrading influxDB from 1.8 to 2.0, and trying to use the same application logic we currently have, we are getting a 401 unauthorized when trying to insert data using the admin user which was specified in the upgrade environment variables.

Error raised: 401: {"code":"unauthorized","message":"Unauthorized"}

This is the docker-compose that was used to bring up the instance

  influxdb:
    image: influxdb:2.0
    ports:
      - '8086:8086'
    volumes:
      - ./influxdb:/var/lib/influxdb
      - ./influxdb2:/var/lib/influxdb2

    networks:
      - backend
    environment:
      # - INFLUXDB_ADMIN_USER=admin
      # - INFLUXDB_ADMIN_PASSWORD=supersecret
      # - INFLUXDB_DB=db0
      - DOCKER_INFLUXDB_INIT_MODE=upgrade
      - DOCKER_INFLUXDB_INIT_USERNAME=admin
      - DOCKER_INFLUXDB_INIT_PASSWORD=supersecret
      - DOCKER_INFLUXDB_INIT_ORG=someorg
      - DOCKER_INFLUXDB_INIT_BUCKET=default

rajahaidar avatar Aug 25 '21 10:08 rajahaidar

I'm also getting this in my unraid docker environment. Trying to set up with influxDB2.0 has there been any indication of a solution?

BaneOfKnoll avatar Oct 22 '21 14:10 BaneOfKnoll

Help!

lestercollado avatar Nov 02 '21 21:11 lestercollado

I found some info that indicates the issue I was having. Not sure if it also affects you. https://community.influxdata.com/t/getting-started-with-influxdb-docker-401-unauthorized/16989/3

BaneOfKnoll avatar Nov 02 '21 22:11 BaneOfKnoll

I also come across a similar problem. Mine is running on a VM. I successfully updated from v1.8 to v2.2 on 31-May and operated as usual on 1-Jun. But today (2-Jun), it suddenly rejected all the requests with an unauthorized error. Now, I even can't run any influx command via the CLI.

Please help!

raymond4entrak avatar Jun 02 '22 05:06 raymond4entrak

InfluxDB v1 compatibility requires extra setup using influx v1 authorization create command. InfluxDB v2 API is provided by different library: https://influxdb-client.readthedocs.io/en/stable/index.html

Pick your poison, I would day.

pspacek avatar Jun 06 '22 09:06 pspacek