amazon web services – AWS MQTT Client sdk v2 java using IAM credentials

I’m migrating AWS SDK for java from v1 to v2. Earlier I was instantiating the AWSIotMqttClient like

Credentials cred = awsService.generateTempIAMCredentialsForIOT();

// AWS IAM credentials could be retrieved from AWS Cognito, STS etc.
IOTMqttClient client = new IOTMqttClient(iotEndpoint, clientId, cred.accessKeyId(),
    cred.secretAccessKey(), cred.sessionToken(), this);

the sdk-v2 doesn’t seem to have any way to use IAM credentials for MqttClientConnection or Mqtt5Client.

Does anyone know a possible way to accomplish this via sdk-v2?

Thanks

Read more here: Source link