Menu
Amazon Cognito
Developer Guide

Registering a User with an SDK

Here is a demonstration app showing the Amazon Cognito JavaScript identity SDK signUp method for user pools. See these JavaScript, Android, and iOS tutorials for more code examples.

<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> </head> <body> <script type='text/javascript' src="amazon-cognito-identity.js"></script> <script> var data = { UserPoolId: 'us-east-1_aBcD9efgh', // Insert your user pool id ClientId: '12abcdef3gh4i5j67klmn890p1' // Insert your app client id }; var userPool = new AmazonCognitoIdentity.CognitoUserPool(data); </script> <fieldset> <legend>Cognito Sign Up User Demo</legend> User name: <input type="text" id="username" placeholder="Enter user name..."> <br> <br> Password: <input type="text" id="password" placeholder="Enter password..."> <br> <br> <div style="width:500px;"> <button id="signupUser">Sign Up User</button> </div> <ul id="signupUserResults"></ul> </fieldset> <script> var attributeList = []; document.getElementById('signupUser').addEventListener('click', function () { userPool.signUp(document.getElementById('username').value, document.getElementById('password').value, attributeList, null, function (err, result) { if (err) { alert(err); return; } document.getElementById('signupUserResults').innerHTML = "Results: " + JSON.stringify( result.user, null, 2); cognitoUser = result.user; console.log(cognitoUser); }); }); </script </body> </html>