【问题标题】:AWS Cognito User Pool Settings For Mobile App移动应用程序的 AWS Cognito 用户池设置
【发布时间】:2018-03-08 06:42:33
【问题描述】:

我真的很难让用户在我的 Xamarin 移动应用程序中注册和确认工作。我已经得到了注册请求,并且用户成功地出现在用户池中为未确认。但是,当我尝试关注 this general guide(当我使用 Xamarin 时,该指南专门针对 Android,并且通过扩展,C#)我在调用 ConfirmSignUpAsync 方法时收到 NotAuthorizedException。

总的来说,我是 Amazon Web Services 的新手,我认为我可能有一些设置或角色配置错误,这阻碍了我确认用户。具体来说,我认为我需要用户池的应用程序客户端设置部分的帮助。我认为这些不会引起问题,因为我的印象是您不需要任何身份验证来注册和确认用户。这是我目前在这些设置中的内容:

这是我尝试使用验证码确认电子邮件地址的代码:

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

【问题讨论】:

    标签: amazon-web-services xamarin amazon-cognito


    【解决方案1】:

    尝试在 AmazonCognitoIdentityProviderClient 上使用 AnonymousAWSCredentials,例如尝试更改:

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

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

    【讨论】:

    • 哇。我可以发誓我以前尝试过,它确实有效。谢谢。
    猜你喜欢
    • 2019-06-11
    • 2019-06-21
    • 2021-08-24
    • 2016-08-06
    • 2020-06-14
    • 2020-06-21
    • 1970-01-01
    • 2018-01-31
    • 2018-11-07
    相关资源
    最近更新 更多