By using AWS re:Post, you agree to the Terms of Use

AWS Cognito - .NET Framework

0

I'm trying to connect to AWS Cognito from a .net Framework project.

I can sign up succesfully but when I need to sign in, throws me an error: "User pool {userPool} client does not exist".

This is my code:

private async Task<bool> CheckPasswordAsync(string userName, string password)
        {
            try
            {

                
                var authReq = new AdminInitiateAuthRequest
                {
                    UserPoolId = ConfigurationManager.AppSettings["USERPOOL_ID"],
                    ClientId = ConfigurationManager.AppSettings["CLIENT_ID"],
                    AuthFlow = AuthFlowType.ADMIN_NO_SRP_AUTH,
                    
                };
                authReq.AuthParameters.Add("USERNAME", userName);
                authReq.AuthParameters.Add("PASSWORD", password);
                

                AdminInitiateAuthResponse authResp = await _client.AdminInitiateAuthAsync(authReq);


                var auts = authResp;
                return true;
            }
            catch(Exception ex)
            {
                var exc = ex.Message;
                return false;
            }
        }

I don't know if I need to add more information to the method.

The user pool exists and is the same that I have in appSettings.

Any idea about what's wrong?

Thanks in advance.

1 Answer
0

Hello,

Thank you for your question.

Your code is missing some prerequisite steps needed to register the user pool. I have attached a document that shows the step by step on how to register and authenticate with Cognito user pools. I have also included a document that contains code examples.

Documentation:

https://aws.amazon.com/blogs/mobile/use-csharp-to-register-and-authenticate-with-amazon-cognito-user-pools/

https://docs.aws.amazon.com/code-library/latest/ug/cognito-identity-provider_code_examples.html

answered a month ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions