2017-09-26 27 views
0

私はXamarinモバイルアプリでユーザーのサインアップと確認を行うことに本当に苦労しています。私は働くサインアップの要求を得て、ユーザーは確認されていないユーザープールに正常に表示されます。しかし、私はthis general guide(私はXamarinを使用している間、具体的にAndroid向けのガイドであり、拡張子はC#)に従うと、ConfirmSignUpAsyncメソッドを呼び出すときにNotAuthorizedExceptionが発生します。AWS Cognitoのユーザープール設定モバイルアプリ

私は一般的にAmazon Web Servicesの初心者です。設定や役割が正しく設定されていないと、ユーザーの確認が妨げられている可能性があります。具体的には、ユーザープールのApp Client Settings部分について助けが必要だと思います。私はあなたがサインアップしてユーザーを確認するための認証を必要としていないという印象を受けていたので、これらは問題を引き起こすはずだと思いませんでした。ここで私は現在、これらの設定に持っているものである:ここでは App client settings

は、検証コードとメールアドレスを確認しようとするための私のコードは次のとおりです。例をしようとするために

public async Task<Exception> VerifyEmail(String sUsername, String sVerificationCode) 
    { 

     CognitoAWSCredentials oCreds = new CognitoAWSCredentials(sIdentityPoolID, Amazon.RegionEndpoint.USEast2); 
     AmazonCognitoIdentityProviderClient oClient = new AmazonCognitoIdentityProviderClient(oCreds, Amazon.RegionEndpoint.USEast2); 
     CognitoUserPool oUserPool = new CognitoUserPool(sUserPoolID, sClientID, oClient); 
     CognitoUser oCognitoUser = new CognitoUser(sUsername, sClientID, oUserPool, oClient); 

     try 
     { 
      await oCognitoUser.ConfirmSignUpAsync(sVerificationCode, false); 
      return null; 
     } 
     catch (Exception e) 
     { 
      return e; 
     } 
    } 

答えて

1

は、AmazonCognitoIdentityProviderClientにAnonymousAWSCredentialsを使用してみてください変更:

AmazonCognitoIdentityProviderClient oClient = new AmazonCognitoIdentityProviderClient 
(oCreds, Amazon.RegionEndpoint.USEast2); 

AmazonCognitoIdentityProviderClient oClient = new AmazonCognitoIdentityProviderClient 
(new AnonymousAWSCredentials(), RegionEndpoint.USEast2); 
+0

うわー。私は以前にそれを試していたと誓っていたかもしれませんが、ちょっと働いていましたありがとう。 – Tristan

関連する問題