我正在使用Amazon Web Services为iOS应用程序的用户进行身份验证。 我有一个屏幕用电话号码注册。当用户输入他的电话号码时,他会得到一个OTP代码,然后他将在验证屏幕中输入该代码。最后,验证无误后,App推送创建用户名&密码屏幕。这就是我想要的。 但是,亚马逊Web服务只提供注册方法如下:如何使用Cognito用户池注册用户 - Amazon Web Services没有用户名和密码
AWSCognitoIdentityUserAttributeType * phone = [AWSCognitoIdentityUserAttributeType new];
phone.name = @"phone_number";
//phone number must be prefixed by country code
phone.value = @"+15555555555";
AWSCognitoIdentityUserAttributeType * email = [AWSCognitoIdentityUserAttributeType new];
email.name = @"email";
email.value = @"[email protected]";
//register the user
[[pool signUp:@"username" password:@"password" userAttributes:@[email,phone] validationData:nil] continueWithBlock:^id _Nullable(AWSTask<AWSCognitoIdentityUserPoolSignUpResponse *> * _Nonnull task) {
dispatch_async(dispatch_get_main_queue(), ^{
if(task.error){
[[[UIAlertView alloc] initWithTitle:task.error.userInfo[@"__type"]
message:task.error.userInfo[@"message"]
delegate:self
cancelButtonTitle:@"Ok"
otherButtonTitles:nil] show];
}else {
AWSCognitoIdentityUserPoolSignUpResponse * response = task.result;
if(!response.userConfirmed){
//need to confirm user using user.confirmUser:
}
}});
return nil;
}];
正如你看到的,我一定要当我的电话号码注册创建用户名和密码。但我想创建用户名并稍后通过。谁能帮我解决这个问题?谢谢!
谢谢!这也是我最后的解决方案 –