2017-09-26 82 views
0

我真的很努力讓用戶註冊並確認在我的Xamarin移動應用程序中工作。我已經收到註冊請求,並且用戶未經確認成功出現在用戶池中。但是,當我嘗試遵循this general guide(指南針對Android,特別是在我使用Xamarin以及擴展C#時)時,調用ConfirmSignUpAsync方法時,我得到NotAuthorizedException。AWS Cognito移動應用程序的用戶池設置

我是亞馬遜網絡服務的新手,我想我可能會有一些設置或角色配置錯誤,阻礙我確認用戶。具體來說,我認爲我需要用戶池的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

相關問題