iOSアプリケーションのユーザー認証にAmazon Web Servicesを使用しています。 私は電話番号で画面をサインアップしています。ユーザーが電話番号を入力すると、OTPコードが取得され、Verify Screenにそのコードを入力します。最後に、正しいことを確認した後、アプリケーションはUsername &パスワードスクリーンを作成するために押します。それは私が欲しいものです。 しかし、Amazon Webサービスは以下のようにregisterメソッドを提供します。あなたが見ることができるように、私は電話番号を登録するとき、私は、ユーザー名とパスワードを作成する必要がありますCognito User Poolでユーザーをサインする方法 - ユーザー名とパスワードを使用しないAmazon Webサービス
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;
}];
。しかし、私はユーザー名を作成し、後で渡したいと思います。誰がこの問題を解決するのを助けることができますか?ありがとう!
ありがとう!それも私の最後の解決策です –