Reputation: 2533
I'm developing an app which makes use of both AWS Mobile Analytics and Cognito Sync for user data. From looking at my network logs, I can see that the AMA.Manager
for Mobile Analytics makes the same API calls as Cognito Sync to request limited temp credentials from AWS.
AWS.config.credentials.get()
My question is if its possible for both new AMA.Manager()
and new AWS.CognitoSyncManager()
to use the same unauthenticated identity which is requested initially from AWS.config.credentials.get()
? Assuming they're both using the same Identity Pool.
Upvotes: 0
Views: 131
Reputation: 2533
Solved my own issue. As long as both AMA.Manager
and AWS.CognitoSyncManager
are initialized with the same credentials provider using a single IdentityPoolId it works fine. Example of my code below:
AWS.config.region = 'us-east-1';
AWS.config.credentials = new AWS.CognitoIdentityCredentials({
IdentityPoolId: SHARED_COGNITO_IDENTITY_POOL_ID
});
var analytics = null;
var syncClient = null;
var options = {
appId : MOBILE_ANALYTICS_APP_ID
};
AWS.config.credentials.get(function(err) {
if(!err){
syncClient = new AWS.CognitoSyncManager();
analytics = new AMA.Manager(options);
}
});
Upvotes: 0