Reputation: 138
if let pool = Aws.pool {
showLoadingView()
let emailAttribute = AWSCognitoIdentityUserAttributeType(name: "email", value: email)
pool.signUp(email, password: password, userAttributes: [emailAttribute], validationData: nil).continueWith { task in
DispatchQueue.main.async {
self.hideLoadingView()
if let error = task.error {
print(error.localizedDescription)
self.displayAlert(message: "error_alert".localized)
} else if let user = task.result?.user {
Session.shared.newUser = Session.NewUser(awsUser: user, email: email, password: password, mobileNumber: mobileNumber)
if let confirmed = task.result?.userConfirmed,
confirmed != NSNumber(value: AWSCognitoIdentityUserStatus.confirmed.rawValue) {
self.navigationController?.pushViewController(AuthenticationViewController.instance(), animated: true)
} else {
Aws.login(navigationController: self.navigationController!, email: email, password: password)
}
}
}
return nil
}
}
Error message from AWS:
The operation couldn’t be completed. (com.amazonaws.AWSCognitoIdentityProviderErrorDomain error 37.)
When I log in with the same identity pool, there is not an error. What is the issue here, and why is there no information anywhere about error 37?
Upvotes: 0
Views: 424
Reputation: 919
The error code that you are seeing corresponds with AWSCognitoIdentityProviderErrorUsernameExists.
It is the numeric value of the enum that you see in the reference link. Are you trying to sign-up a username that already exists?
Upvotes: 3