Here's what I did to create an AWS Cognito "staging" environment that doesn't send real notifications to users. Actually there were several different parts, but I think I was able to cover everything. It would be nice if Cognito simply provided the "User Pool" parameter to disable all notifications, so I donโt need to write the environment logic in my code.
Deny user invitations
AdminCreateUser , . . , MessageAction: 'SUPPRESS' . :
let params = {
UserPoolId: config.cognitoUserPoolId,
Username: uuid.v4(),
MessageAction: 'SUPPRESS',
TemporaryPassword: user.phone_number.slice(-6),
UserAttributes: [
{ Name: 'given_name', Value: user.first_name },
{ Name: 'family_name', Value: user.last_name },
{ Name: 'phone_number', Value: user.phone_number }
]
};
cognito.adminCreateUser(params).promise().then(data => {
console.log(data);
});
: http://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_AdminCreateUser.html
, , . . " ?" .
