I am using AWS Cognito. The scenario is very simple. The user is prompt to enter a username, password, email address and phone number. The requirement is that when the user presses Sign Up button, a confirmation email is sent to the provided email address. After confirmation, he gets successfully signed up.
Things did till now:
Created Xcode project and installed the necessary pods.
Set up user pool by following AWS official docs.
Set up configuration by using the following code:
let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .######, identityPoolId: "######")
let configuration = AWSServiceConfiguration(region: ######, credentialsProvider: credentialsProvider)
AWSServiceManager.default().defaultServiceConfiguration = configuration
Used the following code for making users sign up.
@IBAction func SignUpClicked(_ sender: UIButton) {
let userName = textFieldUsername.text
let emailAddress = textFieldEmailAddress.text
let phoneNo = textFieldPhoneNo.text
let password = textFieldPassword.text
let userPool = AWSCognitoIdentityUserPool(forKey: "myApp")
let name = AWSCognitoIdentityUserAttributeType()
name?.name = "name"
name?.value = userName
let phone = AWSCognitoIdentityUserAttributeType()
phone?.name = "phone_number"
phone?.value = phoneNo
let email = AWSCognitoIdentityUserAttributeType()
email?.name = "email"
email?.value = emailAddress
userPool.signUp(userName!, password: password!, userAttributes: [name!, phone!, email!], validationData: nil)
}
What am I supposed to do next? Did I miss anything? I searched a lot but the content found was in objective c or related to signing up using identity providers. So it didn't help!