AWS Cognito移动应用程序的用户池设置

问题描述:

我真的很努力让用户注册并确认在我的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; 
     } 
    } 

尝试使用上AmazonCognitoIdentityProviderClient AnonymousAWSCredentials,例如尝试变化:

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

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

哇。我可以发誓我以前曾尝试过,它有效。谢谢。 – Tristan