2017-01-09 7 views
0

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; 
}]; 

。しかし、私はユーザー名を作成し、後で渡したいと思います。誰がこの問題を解決するのを助けることができますか?ありがとう!

答えて

1

2017年1月9日現在、Amazon Cognitoは、説明したフローをサポートしていません。

フローを元に戻す場合は、Cognitoでこれを行うことができます。 ユーザー名、パスワード、電話番号で申し込む - >アプリユーザーが認証コードを受け取る - >アプリユーザーが認証コードを送信する - >アプリユーザーがサインイン/ 。

ユーザーは、使用した電話番号が確認され、電話番号が「自動確認」になっている場合にのみサインインすることができます。

また、あなたのユーザーが自分の電話番号でログインできるようにするためにエイリアスを使用することができます。 http://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-aliases

+0

ありがとう!それも私の最後の解決策です –

関連する問題