Last active
June 5, 2018 16:53
-
-
Save prasadjay/d5257740385097fbd88c0c8dc313cf97 to your computer and use it in GitHub Desktop.
Register User Cognito
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function RegisterUser(){ | |
var attributeList = []; | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"name",Value:"Prasad Jayashanka"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"preferred_username",Value:"jay"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"gender",Value:"male"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"birthdate",Value:"1991-06-21"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"address",Value:"CMB"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"email",Value:"sampleEmail@gmail.com"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"phone_number",Value:"+5412614324321"})); | |
attributeList.push(new AmazonCognitoIdentity.CognitoUserAttribute({Name:"custom:scope",Value:"admin"})); | |
userPool.signUp('sampleEmail@gmail.com', 'SamplePassword123', attributeList, null, function(err, result){ | |
if (err) { | |
console.log(err); | |
return; | |
} | |
cognitoUser = result.user; | |
console.log('user name is ' + cognitoUser.getUsername()); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment