Wolwgang
Wolwgang

Reputation: 111

CognitoIdentityProviderClient AdminInitiateAuth Unable to verify secret hash for client

As in the title, I'm working on authenticating to amazon cloud via AdminInitiateAuth mode and I'm stuck on "Unable to verify secret hash for client". I can't seem to find what I did wrong here, so I hope for a little help. It's a simple console app, just to try to connect to it.

       //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();
        }

Upvotes: 0

Views: 1211

Answers (1)

Andy Hau
Andy Hau

Reputation: 76

You need to enable the option "Enable sign-in API for server-based authentication (ADMIN_NO_SRP_AUTH)" in your "users pool"'s apps client.

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

Upvotes: 2

Related Questions