You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi @zqb666 - It depends on how the broker authorization is setup but for simple auth:
final Mqtt5BlockingClient client = Mqtt5Client.builder()
.identifier(getClientId())
.serverHost(HOST)
.serverPort(PORT)
.simpleAuth()
.username(USERNAME)
.password(ByteBuffer.wrap(PASSWORD.getBytes(StandardCharsets.UTF_8)))
.applySimpleAuth()
See also this blog post: Authentication with Username and Password
i tyy your code ,fix a little problem, result like this: final Mqtt5BlockingClient client = (Mqtt5BlockingClient) Mqtt5Client.builder() .identifier(UUID.randomUUID().toString()) .serverHost(BROKER_HOST) .serverPort(1883) .simpleAuth() .username(USERNAME) .password(ByteBuffer.wrap(PASSWORD.getBytes(StandardCharsets.UTF_8))) .applySimpleAuth();
1.3.0
hello. how to set username and password when i connect ?
with mqtt5 client
The text was updated successfully, but these errors were encountered: