Skip to content
This repository was archived by the owner on Oct 29, 2024. It is now read-only.

Prevent overwriting Authorization with basic auth#901

Merged
aviau merged 1 commit into
influxdata:masterfrom
zgy730:master
Sep 9, 2021
Merged

Prevent overwriting Authorization with basic auth#901
aviau merged 1 commit into
influxdata:masterfrom
zgy730:master

Conversation

@zgy730
Copy link
Copy Markdown
Contributor

@zgy730 zgy730 commented Sep 8, 2021


Contributor checklist
  • Builds are passing
  • New tests have been added (for feature additions)

@zgy730 zgy730 requested review from aviau and xginn8 as code owners September 8, 2021 12:37
@aviau
Copy link
Copy Markdown
Collaborator

aviau commented Sep 9, 2021

Looks good, thanks!

@aviau aviau merged commit 7cb5656 into influxdata:master Sep 9, 2021
@fetzerch
Copy link
Copy Markdown

fetzerch commented Jan 6, 2022

@aviau Is there a chance that you publish a new patch release to PyPI with this included any time soon?

The patch enables the connection to InfluxDB v2 via:

client = influxdb.InfluxDBClient(
        database="xyz",
        headers={
            "Authorization": "Token <base64 encoded token>"
        },
    )

This seems to be the only way of running existing scripts (that use InfluxQL queries) against the v1 compatibility API of InfluxDB v2. Unfortunately I do still have some scripts which I can't migrate to Flux because that's still missing some features.

@SGStino
Copy link
Copy Markdown

SGStino commented Jan 27, 2022

ran into this issue, turns out that username='root', password='root' makes it overwrite the Authorization header

using this fixes it:

client = influxdb.DataFrameClient(host='<hostname>', username=None, password=None, headers={'Authorization':'Token <token_without_extra_encoding>'})

In version 5.3.1 from pip (which, by the way, doesn't have a tag in this repo yet?)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants