I am creating an angular app, in which I want to add authentication via AWS Cognito (I am pretty new to AWS). I successfully added functionality for sign-up, sign-in, sign-out, mfa and more. In addition I want to create something like admin panel, where admins can change general users` attributes. But I am not sure how to implement these admin things. How should admins sign-in? How should admins sign-up? Is there a dedicated user pool for them? And then how to manage (change attributes of) the general users as an admin?
I have gone trough the AWS Documentation, but it is not clear enough. I see that there is some kind of actions prefixed with Admin
like AdminUpdateUserAttributes
but I am not really sure how to use them.
Edit: I have tried something like this:
const AWS = require('aws-sdk');
let cognitoIdentityServiceProvider = new AWS.CognitoIdentityServiceProvider({apiVersion: '2016-04-18'});
let params = {
UserAttributes: [{
Name: 'custom:state',
Value: this.newValue
}],
UserPoolId: 'us-east-1_example',
Username: this.username
};
cognitoIdentityServiceProvider.adminUpdateUserAttributes(params, function(err, data) {
// do something with result
err && console.error(err);
data && console.log(data);
});
But I am getting the following error: CredentialsError: Missing credentials in config
How should I set these credentials?