Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Token authentication for influx1.8 not working?

Abierto
#551 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python

Línea de trabajo

Comienza con el punto de entrada de InfluxDBClient usando el parámetro token y reproduce la respuesta 401 contra InfluxDB 1.8.2 o 1.8.3 con el JWT proporcionado y ambas formas del token. Compara la solicitud de autenticación del cliente V2 con las credenciales esperadas por el servidor; se considera terminado cuando se confirma el uso compatible o la incompatibilidad y el comportamiento se corrige o se documenta.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug
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
                    )
Lenguaje dominante
Python
Estrellas
792
Forks
186
Merge medio
3 h 2 min
PR fusionados (30 d)
1

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de influxdata/influxdb-client-python

Todos los issues de influxdata/influxdb-client-python

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.