我正在使用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;
}];
正如你看到的,我一定要當我的電話號碼註冊創建用戶名和密碼。但我想創建用戶名並稍後通過。誰能幫我解決這個問題?謝謝!
謝謝!這也是我最後的解決方案 –