CognitoIdentityProviderClient AdminInitiateAuth无法验证客户端的秘密哈希

时间:2018-09-27 06:35:42

标签: c# amazon-web-services amazon-cognito

正如标题中所述,我正在通过AdminInitiateAuth模式向Amazon Cloud进行身份验证,并且停留在“无法验证客户端的秘密哈希”上。我似乎在这里找不到我做错了什么,因此希望能有所帮助。这是一个简单的控制台应用程序,只是为了尝试连接到它。

       //connection data
        public const string User
        public const string Password
        public const string UserPoolId
        public const string AppClientId
        public const string AppClientSecret
        public const string AccessKey
        public const string SecretKey

        static void Main(string[] args)
        {
            var client = new AmazonCognitoIdentityProviderClient(AccessKey, SecretKey, RegionEndpoint.EUCentral1);
            var parameters = new Dictionary<string, string> {{"USERNAME", User}, { "SECRET_HASH", SecretKey }, {"PASSWORD", Password}};
            client.AdminInitiateAuth(new AdminInitiateAuthRequest
            {
                AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH,
                UserPoolId = UserPoolId,
                ClientId = AppClientId,
                AuthParameters = parameters


            });
            System.Console.WriteLine("Worked");
            System.Console.ReadKey();
        }

1 个答案:

答案 0 :(得分:0)

您需要在“用户池”的应用程序客户端中启用选项“ 为基于服务器的身份验证启用登录API(ADMIN_NO_SRP_AUTH)”。< / p>

Enable sign-in API for server-based authentication (ADMIN_NO_SRP_AUTH)