我正在使用 aws cognito 为我的应用程序创建客户并将他们的 id 存储在我的数据库中以保留本地记录。我为管理员用户使用了本地数据库。我已经使用 aws amplify 注册用户但是我在以管理员身份登录时删除用户时遇到问题。
我正在使用 aws sdk
aws.config.update({
accessKeyId: "string",
secretAccessKey: "string",
region: process.env.REACT_APP_REGION
});
aws.config.credentials = new aws.CognitoIdentityCredentials({
IdentityPoolId: process.env.REACT_APP_IDENTITYPOOLID,
AllowUnauthenticatedIdentities: true,
AccountId: 'string',
RoleArn: 'arn:aws:iam::string:role/Cognito_WebReactAuth_Role',
});
var params = {
UserPoolId: process.env.REACT_APP_USERPOOLID,
Username: id,
};
var cognitoidentityserviceprovider = new aws.CognitoIdentityServiceProvider();
cognitoidentityserviceprovider.adminDeleteUser(params, function(err, data) {
if (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
但它给了我错误 Not authorized to perform sts:AssumeRoleWithWebIdentity and CredentialsError: Missing credentials in config
我想要实现的是使用我的本地数据库以管理员身份登录并列出本地数据库中的所有客户。当我从 cognito 中单击删除用户时,本地数据库将被删除。
任何帮助表示赞赏。