Closed
Description
Hi. I'm using this library in a React project to have the ability to subscribe to events. I use the cognito identity method on the browser side to get credentials. It was very simple to do in v1 but now I'm trying to upgrade to v2. In v1 I could do updateWebSocketCredentials
to update the credentials, but I can't find anything similar in v2.
I've tried various methods in v2, such as using new_with_websockets
that accepts options:
let config = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets({
region: awsConfiguration.region,
service: "wss",
credentials_provider: {
getCredentialsAsync: async () => {
const credentials: any = await getCredentialsAsync();
if (credentials) {
expiration = credentials.Expiration;
return {
accessKeyId: credentials.AccessKeyId,
secretAccessKey: credentials.SecretKey,
sessionToken: credentials.SessionToken,
expiration: credentials.Expiration,
};
}
return null;
},
},
})
But that doesn't seem to work.
Is there no method to update the credentials when they expire? I found one React example that uses something called .with_credential_provider
that doesn't seem to exist any longer.
Any help would be appreciated.
Activity