influxdata / influxdata/influxdb-client-python
Token authentication for influx1.8 not working?
まだ誰も着手していません。
- 主要言語
- Python
- スター
- 793
- フォーク
- 186
- 平均マージ
- 3時間 2分
- マージ済み PR(30日)
- 1
説明
### Specifications
* Client Version: 1.35.0
* InfluxDB Version: 1.8.2
* Platform: Ubuntu 20.04.5 LTS
### Code sample to reproduce problem
```
client = InfluxDBClient(
url=influx_url,
verify_ssl=False,
token=influx_token,
debug=True
)
```
where influx_token is jwt token in string format. example: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6ImFkbWluIiwiZXhwIjoxNzAxODIwODAwfQ.LraKXlamiE9pr0owDgSdDt3FMKR3pVNolLVxm4ULG-8"
Used following payload when generating jwt:
```
{
"username": "admin",
"exp": 1701820800
}
```
### Expected behavior
Should authenticate using token in V2 client. Use of same token in V1 python client works fine. Am I missing something required to parse the token before feeding it to the InfluxDBClient instantiation in V2 python client?
### Actual behavior
I receive a parsing error for the token authentication:
[2023-01-06 16:23:27,933] [7642] [ERROR] [influx_connector.py:154] InfluxDB Error: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Request-Id': 'be28dbc8-8e10-11ed-800a-0242ac130003', 'Www-Authenticate': 'Basic realm="InfluxDB"', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': '1.8.3', 'X-Request-Id': 'be28dbc8-8e10-11ed-800a-0242ac130003', 'Date': 'Fri, 06 Jan 2023 22:23:27 GMT', 'Content-Length': '55'})
HTTP response body: b'{"error":"unable to parse authentication credentials"}\n'
### Additional info
If I change how I feed the token parameter to something like below, the error changes to:
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Content-Type': 'application/json', 'Request-Id': '64052e35-8e0d-11ed-8032-0242ac130003', 'Www-Authenticate': 'Basic realm="InfluxDB"', 'X-Influxdb-Build': 'OSS', 'X-Influxdb-Version': '1.8.3', 'X-Request-Id': '64052e35-8e0d-11ed-8032-0242ac130003', 'Date': 'Fri, 06 Jan 2023 21:59:28 GMT', 'Content-Length': '33'})
HTTP response body: b'{"error":"authorization failed"}\n
This leads me to believe something more than just passing the token itself as a string is the problem I'm having. Are there other parameters required when using the token. Do I need to add/edit something to the token string itself?
```
client = InfluxDBClient(
url=influx_url,
verify_ssl=False,
token=f'{influx_user}:{influx_token}',
debug=True
)
```
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
tokenパラメーターを使用する InfluxDBClient エントリーポイントから開始し、提供された JWT と両方の token 形式を使って InfluxDB 1.8.2 または 1.8.3 に対する 401 応答を再現します。V2 クライアントの認証リクエストを、サーバーが想定する認証情報と比較します。対応している使用方法または非互換性が確認され、動作が修正または文書化されれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- authentication, databases
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100