influxdata/influxdb-client-java

Java client library: finfluxdb client | influx HTTP status code: 401; Message: Unauthorized access.

annikaImBuero opened this issue · 4 comments

Java client library: influxdb client
https://github.com/influxdata/influxdb-client-java

Builder builder = InfluxDBClientOptions.builder();
builder.url(serverUrl);
if (!token.isEmpty()) {
builder.authenticateToken(token.toCharArray()); // 1.
} else {
builder.authenticate(username, password.toCharArray()); // 2.
}
builder.bucket(bucketName);
builder.org(organization);
InfluxDBClientOptions options = builder.build();

  1. the connection via builder.authenticateToken(token.toCharArray()); works.
  2. If the connection is made via builder.authenticate(username, password.toCharArray()); --> error message
    influx HTTP status code: 401; message: Unauthorized access

Hi,

Were you able to resolve your issue? There appears to be a working example using username/password auth: #469

Thank you for your answer and the reference to the example.
In the example is a different error.
I do it exactly as recommended in the example in an answer. It also works with use of the token, but not with the username and password, although it has been ensured that these are correct.

In the example is a different error.

what is the new error?

image

#DATASOURCE_1003_NOT_STARTED#HTTP status code: 401; Message: unauthorized access Bad status for datasource 'influx' of type 'InfluxDB'.

image