Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
annikaImBuero opened this issue Mar 22, 2023 · 4 comments
Labels
question Further information is requested

Comments

@annikaImBuero
Copy link

annikaImBuero commented Mar 22, 2023

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
@powersj
Copy link
Contributor

powersj commented Mar 27, 2023

Hi,

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

@powersj powersj added the question Further information is requested label Mar 27, 2023
@annikaImBuero
Copy link
Author

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.

@annikaImBuero annikaImBuero changed the title influx HTTP status code: 401; Message: Unauthorized access. Java client library: finfluxdb client | influx HTTP status code: 401; Message: Unauthorized access. https://github.com/influxdata/influxdb-java Mar 31, 2023
@annikaImBuero annikaImBuero changed the title Java client library: finfluxdb client | influx HTTP status code: 401; Message: Unauthorized access. https://github.com/influxdata/influxdb-java Java client library: finfluxdb client | influx HTTP status code: 401; Message: Unauthorized access. Mar 31, 2023
@powersj
Copy link
Contributor

powersj commented Mar 31, 2023

In the example is a different error.

what is the new error?

@annikaImBuero
Copy link
Author

image

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

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants