Skip to content

Instantly share code, notes, and snippets.

@matthieu-D
Last active June 7, 2017 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthieu-D/bed87d81ea229abe8f876ead3f030d13 to your computer and use it in GitHub Desktop.
Save matthieu-D/bed87d81ea229abe8f876ead3f030d13 to your computer and use it in GitHub Desktop.
register(username, password, attr) {
let attributes = [];
for (var x in attr) {
attributes.push(this.cognito.makeAttribute(x, attr[x]));
}
return new Promise((resolve, reject) => {
this.cognito.getUserPool().signUp(username, password, attributes, null, function(err, result) {
if (err) {
reject(err);
} else {
resolve(result.user);
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment