Skip to content

Instantly share code, notes, and snippets.

@prasadjay
Last active June 5, 2018 17:12
Show Gist options
  • Save prasadjay/071e0c8225d2b37191ca7b08b34d965b to your computer and use it in GitHub Desktop.
Save prasadjay/071e0c8225d2b37191ca7b08b34d965b to your computer and use it in GitHub Desktop.
Update-User-Cognito
function update(username, password){
var attributeList = [];
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({
Name: "custom:scope",
Value: "some new value"
}));
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({
Name: "name",
Value: "some new value"
}));
var authenticationDetails = new AmazonCognitoIdentity.AuthenticationDetails({
Username: username,
Password: password,
});
var userData = {
Username: username,
Pool: userPool
};
var cognitoUser = new AmazonCognitoIdentity.CognitoUser(userData);
cognitoUser.updateAttributes(attributeList, (err, result) => {
if (err) {
//handle error
} else {
console.log(result);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment