in java/src/main/java/com/alexa/awisapi/CognitoHelper.java [96:129]
boolean SignUpUser(String username, String password, String email, String phonenumber) {
AnonymousAWSCredentials awsCreds = new AnonymousAWSCredentials();
AWSCognitoIdentityProvider cognitoIdentityProvider = AWSCognitoIdentityProviderClientBuilder
.standard()
.withCredentials(new AWSStaticCredentialsProvider(awsCreds))
.withRegion(Regions.fromName(REGION))
.build();
SignUpRequest signUpRequest = new SignUpRequest();
signUpRequest.setClientId(CLIENTAPP_ID);
signUpRequest.setUsername(username);
signUpRequest.setPassword(password);
List<AttributeType> list = new ArrayList<>();
AttributeType attributeType = new AttributeType();
attributeType.setName("phone_number");
attributeType.setValue(phonenumber);
list.add(attributeType);
AttributeType attributeType1 = new AttributeType();
attributeType1.setName("email");
attributeType1.setValue(email);
list.add(attributeType1);
signUpRequest.setUserAttributes(list);
try {
SignUpResult result = cognitoIdentityProvider.signUp(signUpRequest);
} catch (Exception e) {
System.out.println(e);
return false;
}
return true;
}